r-markdown

Prevent re-knitting of old rmd files when publishing blogdown website on shared server

混江龙づ霸主 提交于 2020-07-22 05:22:08
问题 I read this post and the blogdown documentation, but I can't seem to find a relevant answer for my case. EDIT: I found this blog post describing a workaround using build_site(method="custom") . I needed to change a few things (from md to html in some parts, since the knitted final format is html in my case). It seems to work for simple Rmds, but fancy interactive plots requiring htmlwidgets don't render correctly. I recently switched from Wordpress to Hugo and I have a shared server for

How to download Rhandsontable output into .xlsx and .pdf?

邮差的信 提交于 2020-07-18 08:41:25
问题 I would like to download rhandsontable output object from an R Shiny app into .xlsx and .pdf format. Does anyone have any idea how to do this? For example, I want to download the tables in the results tab in the app below (the codes are copied from my other question earlier): library(shiny) library(rhandsontable) ui <- navbarPage("App", tabPanel("Input", numericInput('num_of_table', "Number of sub tabs: ", value = 1, min = 1, max = 10), uiOutput("input")), tabPanel("Results", uiOutput(

Use a variable name with spaces inline in R markdown

混江龙づ霸主 提交于 2020-07-15 07:38:57
问题 How can I include inline R code that refers to a variable name that contains spaces or other unusual characters (actual use-case is Pr(>F) )? Backticks are the solution in plain R script, but they don't seem to work when the code is inline in a markdown doc. Here's an example: ```{r} df <- data.frame(mydata= 1:10, yourdata = 20:29) names(df) <- c("your data", "my data") ``` The first five values of your data are `r df$`your data`[1:5]` Which when knitted gives: Quitting from lines 7-9 (test

Use a variable name with spaces inline in R markdown

纵饮孤独 提交于 2020-07-15 07:34:11
问题 How can I include inline R code that refers to a variable name that contains spaces or other unusual characters (actual use-case is Pr(>F) )? Backticks are the solution in plain R script, but they don't seem to work when the code is inline in a markdown doc. Here's an example: ```{r} df <- data.frame(mydata= 1:10, yourdata = 20:29) names(df) <- c("your data", "my data") ``` The first five values of your data are `r df$`your data`[1:5]` Which when knitted gives: Quitting from lines 7-9 (test

kable: Vertical alignment does not work with pdf output

时光毁灭记忆、已成空白 提交于 2020-07-09 06:14:59
问题 I am trying to produce a large table in pdf mixing text and figures using kable . I am trying to align every row to the top. I made an example using a figure test.jpg located inside the working directory. I am using the version 1.22 of knitr . --- output: pdf_document --- ```{r} table <- data.frame( col1 = "test", col2 = "![test](test.jpg){width=150px}") knitr::kable(table) ``` It behaves correctly and aligns the figure and the text to the top if I knit it in html but it aligns the figure and

How to resize tables generated by Stargazer in R Markdown?

≡放荡痞女 提交于 2020-07-06 08:17:42
问题 I included resize.height=0.5,resize.width=0.5 in the code chunk, but still can't resize the table generated by stargazer. Can anyone tell me why? My code chunk options look like this: echo=FALSE,warning=FALSE,results='asis',resize.height=0.5,resize.width=0.5} The stargazer codes are like this: stargazer(did.student,student.control.kmt,student.control.neu,student.control.dpp,header = FALSE, title="DD Model", covariate.labels = c("Treatment","group","Treatment*group"), dep.var.labels =

How to resize tables generated by Stargazer in R Markdown?

[亡魂溺海] 提交于 2020-07-06 08:17:30
问题 I included resize.height=0.5,resize.width=0.5 in the code chunk, but still can't resize the table generated by stargazer. Can anyone tell me why? My code chunk options look like this: echo=FALSE,warning=FALSE,results='asis',resize.height=0.5,resize.width=0.5} The stargazer codes are like this: stargazer(did.student,student.control.kmt,student.control.neu,student.control.dpp,header = FALSE, title="DD Model", covariate.labels = c("Treatment","group","Treatment*group"), dep.var.labels =

How to facet across tabs in ggplot2 / Rmarkdown?

被刻印的时光 ゝ 提交于 2020-07-06 05:27:20
问题 I am aware of facet_wrap and facet_grid for faceting. For more detailed graphics requiring more space, it could be useful to easily be able to facet across Rmarkdown tabs Other than copying the graphic's code into each tab and filtering for the facet variable separately in each one, is there a native (ggplot2/Rmarkdown) way to do this? To borrow the example from the linked question, the desired output would be to have the first facetted plot where it says 'tab content 1', and the second in

kableExtra: Dynamic add_header_above labeling

家住魔仙堡 提交于 2020-07-04 08:58:08
问题 I would like to create a pdf with rmarkdown. The PDF should contain a table. The table should have a dynamic column label. The tabhead should display the calendar week. However, the calendar week (e.g., KW29) is not displayed but the variable name "kw0". What is my error? library(knitr) library(kableExtra) library(lubridate) options(knitr.table.format = "latex") loadData <- function() {# load some data} myData<- loadData () kw0 <- paste("KW", week(Sys.Date()) - 1, sep = "") kw1 <- paste("KW",

kableExtra: Dynamic add_header_above labeling

不打扰是莪最后的温柔 提交于 2020-07-04 08:58:07
问题 I would like to create a pdf with rmarkdown. The PDF should contain a table. The table should have a dynamic column label. The tabhead should display the calendar week. However, the calendar week (e.g., KW29) is not displayed but the variable name "kw0". What is my error? library(knitr) library(kableExtra) library(lubridate) options(knitr.table.format = "latex") loadData <- function() {# load some data} myData<- loadData () kw0 <- paste("KW", week(Sys.Date()) - 1, sep = "") kw1 <- paste("KW",