r-markdown

How do I produce R package vignettes in multiple formats?

末鹿安然 提交于 2019-12-14 03:40:39
问题 I use knitr and rmarkdown to write vignettes for R packages. Thanks to the magic of pandoc it is easy to turn these documents into a variety of formats. I would like to take advantage of this by offering vignettes as both HTML and PDF. There is support from rmarkdown to specify parameters for multiple output formats in the documents metadata block. For example, I might have something like this: output: html_document: standalone: true smart: true normalize: true toc: true highlight: tango self

error 43 in pandoc: render Rmd with rmarkdown include LaTeX qtree

自古美人都是妖i 提交于 2019-12-14 02:12:08
问题 I am trying to produce a tree diagram in a Rmd file I expect to look like this: Using rmarkdown 's render function. But get an error 43 I do not know how to interpret. How can I get the pdf to render? What's causing the error? Rmd file --- title: "testtree" header-includes: - \usepackage{qtree} output: pdf_document --- \Tree [.S [.NP LaTeX ] [.VP [.V is ] [.NP fun ] ] ] Success Error message > rmarkdown::render("testtree.Rmd", "all") processing file: testtree.Rmd |............................

Rmarkdown and DT: result do not render

人盡茶涼 提交于 2019-12-14 02:05:46
问题 Do you know how to render this in Rmarkdown? ```{r, results='asis'} library(DT) obj <- data.frame(B=as.numeric(1:18), C=as.factor(c("A","B","C")), stringsAsFactors=FALSE) obj <- split(obj, obj$C, drop = TRUE) lapply(obj, function(x) { datatable(x, filter = 'top', options = list( pageLength = 12, autoWidth = TRUE)) } ) ``` DT tables render in the Viewer of RStudio but cannot have the splitted tables in the .Rmd.. what am I missing? 来源: https://stackoverflow.com/questions/33343241/rmarkdown-and

run just code from one Rmarkdown document in another Rmarkdown document with duplicate chunk names

核能气质少年 提交于 2019-12-14 01:18:29
问题 I am writing a series of reports in Rmarkdown that build off each other. I would like to include the results from the previous report in the report I am currently working on. I have seen other questions that suggested using purl to extract R code from a Rmarkdown document and then run that, so I tried the following: ```{r read.previous, echo=FALSE} source(knitr::purl("previous.Rmd",output=tempfile(),documentation=0)) ``` But when I try to knit the current report, it fails, complaining that

Error when knitting github_document: pandoc document conversion failed with error 67

不羁的心 提交于 2019-12-14 01:03:59
问题 I'm generating a README.md GitHub page from a Rmd file. It was generated correctly a week ago but now it's throwing the following error: "C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS README.md --to html --from markdown_github --output README.html --standalone --self-contained --highlight-style pygments --template "C:\Users\E\Documents\R\win-library\3.3\rmarkdown\rmarkdown\templates\github_document\resources\preview.html" --variable "github-markdown-css:C:\Users\E\Documents\R

Pandoc's environment cslreferences undefined when knitting RMarkdown to PDF in RStudio

ⅰ亾dé卋堺 提交于 2019-12-13 20:41:45
问题 Knitting (in RStudio version 1.2.1335) an RMarkdown file to PDF fails when trying to create citations (for pandoc version 2.8.0.1, and R version 3.6.1). (This does not happen when knitting to HTML, for example.) Here is a small rep. ex. in RMarkdown: --- title: "Rep. Ex. for 'LaTeX Error: Environment cslreferences undefined'" output: pdf_document: default bibliography: report.bib --- ```{r generate-bibtex-file, include=FALSE} knitr::write_bib(file = "report.bib", prefix = "") ``` # Used R

Make NA values in table just blank cells when using cell_spec in kableExtra [duplicate]

社会主义新天地 提交于 2019-12-13 20:25:36
问题 This question already has answers here : Hiding NA's when printing a dataframe in knitr (2 answers) Closed 7 months ago . Following on from a previous question, I am using the cell_spec function from kableExtra to change the background color of cells within a table. How can you remove the NA text and color the background white for the NA cells so that an NA appears just as a blank cell? Below is my example table with the NA cells. In real life there is a dynamic number of columns with various

How to use Twitter bootstrap grid layout in rmarkdown?

試著忘記壹切 提交于 2019-12-13 17:02:16
问题 I am planning to use rmarkdown to render html pages with R generated content for publishing on websites. The ultimate goal is to render some kind of dashboard like pages (example pages). I know rmarkdown uses twitter bootstrap for its layouts and that's why I was wondering if it is possible to use twitter bootstrap's grid layout within a rendered html document. Maybe I missed some information in the tutorials I found about rmarkdown rendering html pages, but there doesn't seem to be any

accessing global environment objects created in cached chunks Rmarkdown documents

天涯浪子 提交于 2019-12-13 14:50:12
问题 I want to run a R script to run a simulation and cache the results for the Rmarkdown document. I am using Rstudio and try to create an HTML report by using knit HTML Here's a simple example. ```{r test_global_env,cache=TRUE} print(getwd()) source("./test_script.R") ``` ```{r test_global_env_2} print(a) ``` and test_script.R is as follows a<-1 When I change the cache option for the chunk to FALSE , print(a) works. If I set it to TRUE, it works the first time, the second time, I get object 'a'

Subplot with Plotly in R

有些话、适合烂在心里 提交于 2019-12-13 14:15:20
问题 I cannot get a side by side subplot of a piechart using the plotly library in R with R Markdown. Instead, it looks like the subplot is overlaying one pie on top of the other: --- title: "Test Plotly Pie" author: "" date: "" output: html_document: self_contained: no --- ```{r plotpie1, results='asis', tidy=FALSE, message=FALSE, fig.retina=NULL, echo=FALSE, out.width = "99%", out.height="750p[![enter image description here][1]][1]x"} require(plotly) require(dplyr) p1 <- plot_ly(type="pie"