My goal is to render a R script as a Rmarkdown pdf. When I try to render a Rscript using first knitr::spin() to convert it to a .Rmd file and then rmarkdown::render to render the rmd file to a pdf I get the error message:
> rmarkdown::render("testcars.Rmd", "pdf_document")
processing file: testcars.Rmd
|.............................................. | 33%
ordinary text without R code
|............................................................................................ | 67%
label: unnamed-chunk-1
Quitting from lines 3-16 (testcars.spin.Rmd)
Error in sink(con, split = debug) : sink stack is full
I get the same error when I try to use rmarkdown::render() on a .R file.
Here is the Rscript I tried to convert into a Rmarkdown PDF:
library(rmarkdown)
setwd("C:/myworkingdirectory")
data(cars)
str(cars)
summary(cars)
plot(cars)
hist(cars$speed)
boxplot(cars$dist)
knitr::spin(hair = "testcars.R", knit = F, format=c("Rmd"))
rmarkdown::render("testcars.Rmd", "pdf_document")