r-markdown

Can't knit to pdf with custom styles

淺唱寂寞╮ 提交于 2019-12-21 17:49:33
问题 Trying to knit to pdf from RStudio using a custom mystyles.sty file. This used to work fine but now that I have upgraded to RStudio 1.044 I get an error. Example: --- title: "Test" output: pdf_document: includes: in_header: mystyles.sty --- ## R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>. When you click the **Knit** button a document will

Why does datatable not print when looping in rmarkdown?

心已入冬 提交于 2019-12-21 15:32:23
问题 I am working on creating a dynamic rmarkdown document. The end result should create a tab for each 'classification' in the data. Each tab should have a datatable, from the DT package, with the data printed to it. Below is the code I have been using: --- output: html_document --- # Setup{.tabset} ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) library(knitr) library(DT) ``` ```{r data.setup} set.seed = 1242 rows = 64 data.1 = runif(rows, 25, 75) data.2 = runif(rows, .01, 1)

Bookdown: How can I change the size of the chapter titles?

拈花ヽ惹草 提交于 2019-12-21 12:32:07
问题 I am using bookdown to generate slides for a workshop. I use the 'big' letter option in the menu for display as slides. However then the chapter title font size is too large. Where/how can I modify that one? Thanks, Paul 回答1: you can control this with .css as yihui suggests in the top level of your bookdown project there is a file called style.css open it and paste in: .book .book-body .page-wrapper .page-inner section.normal h1{font-size:1em} this will increase the size of your top level

Latex Formulas or symbols in table cells using knitr and kableExtra in R-Markdown,

天大地大妈咪最大 提交于 2019-12-21 12:28:18
问题 Thanks to jaySf I was able to create a pdf file containing beautiful tables with footnotes showing formulas and symbols with R Markdown, Latex, knitr and kableExtra (below his example): --- title: "Untitled" output: pdf_document --- ```{r tab} library(knitr) library(kableExtra) df <- data.frame(v1=rnorm(6), v2=runif(6), v3=rbinom(6, 1, .33), row.names=LETTERS[1:6]) kable(df, "latex", align="c", booktabs=TRUE) %>% footnote(general=c("$a^2+b^2=c^2,$", "$\\\\sigma^2=\\\\frac{1}{n-1}\\\\sum_{i=1}

Latex Formulas or symbols in table cells using knitr and kableExtra in R-Markdown,

…衆ロ難τιáo~ 提交于 2019-12-21 12:26:30
问题 Thanks to jaySf I was able to create a pdf file containing beautiful tables with footnotes showing formulas and symbols with R Markdown, Latex, knitr and kableExtra (below his example): --- title: "Untitled" output: pdf_document --- ```{r tab} library(knitr) library(kableExtra) df <- data.frame(v1=rnorm(6), v2=runif(6), v3=rbinom(6, 1, .33), row.names=LETTERS[1:6]) kable(df, "latex", align="c", booktabs=TRUE) %>% footnote(general=c("$a^2+b^2=c^2,$", "$\\\\sigma^2=\\\\frac{1}{n-1}\\\\sum_{i=1}

Full citation in RMarkdown?

随声附和 提交于 2019-12-21 12:09:27
问题 Is there any way to insert a fully formatted citation in RMarkdown in-text. For example, something like this: You enter the citation key @watson1953 and it renders (as a latex PDF) as Watson, J. D., & Crick, F. H. C. (1953). Molecular structure of nucleic acids: A structure for deoxyribose nucleic acid. Nature, 171(737-738), 3-12. But it does it in exact location of the citation key. The bibliography at the end of the document should also be suppressed. Is there any way to do this? I couldn't

Rmarkdown - Run code and display errors in document

China☆狼群 提交于 2019-12-21 07:39:09
问题 I get an error message when running the code below which is expected - I would like this to be ran and displayed in the pdf, however the error is returned in r and the code doesn't run. {r, warning=TRUE} library(survey) debug(withReplicates.svyrep.design) I have tried warning=TRUE but this doesn't work. How can I get the error displayed in the document? 回答1: Add error=TRUE to the chunk options. That will result in the script running to completion with the error appearing in the output. 来源:

Include code from an external R script, run in, display both code and output

狂风中的少年 提交于 2019-12-21 07:14:28
问题 Is it possible to include code from an external R script in an .Rmd and simultaneously run the code, display the code, and display its results in the output .HTML file? For example, if I have x <- 1 y <- 3 z <- x + y z in external.R . In the output document I want to see the code above along with the result of z , i.e. 4. Essentially, I want the equivalent of what would happen if I copy/pasted what's above in an R chunk. So I want ```{r} some.library::some.function("external.R") ``` to be the

Call a Rmarkdown report in the shiny application

两盒软妹~` 提交于 2019-12-21 06:26:31
问题 I have a shiny application that read a csv file and clean the data and add few columns, ... (I used this example to create the app). At the end the application save the cleaned data ( output.csv ) in the log folder within the application folder. I also design a Rmd file which is in the shiny application folder. The Rmd file uses the output file ( log/output.csv ). I would like to call the Rmd file to show the report after saving the ( output.csv ), How can I do it? 回答1: I found the solution

Adjust the size of plotly charts in slidify

旧城冷巷雨未停 提交于 2019-12-21 05:27:08
问题 I've created a plotly chart in R and then save the plot via htmlwidget so the plot can called in slidify. I played with width and height , in both layout argument and index.Rmd to fit the plot on a slidify slide but the final result always cut the bottom portion of the chart when some texts are added together. How can I truly adjust the size of the plotly chart in slidify? The code in R script ## first slide date <- seq(from = as.POSIXct("2015/4/1"), to = as.POSIXct("2015/10/1"), by = "month"