0

When I run my r-markdown code to generate a PDF, there is text in the place of images. The chunks are run and pdf images generated in the "figure" folder but where the images should be in the PDF is text figure/unnamed-chunk-12.pdf.

I've never had this before and have generated many pdf files successfuly with images. It seems to be when spin(file, format = 'Rmd', report=F) is run, the ![plot of chunk unnamed-chunk-12] and brackets are not put in the md file.

Any ideas why this might be and how I can correct it?

Example:

#' ---
#' title: "Testing the figure generation from 'spin'"
#' ---
#' ****
#+ echo=FALSE, eval = FALSE
    require(knitr)
    require(rmarkdown)
#+

#' # Background  
#' For some reason the plots don't show - they are missing text in the md file.
#' 
#+ echo=FALSE, message = FALSE, warning = FALSE
    plot(rnorm(100), rnorm(100))
#+  
#' But the text still works.  
#' 
#+ eval=FALSE, include = F
    file = "~/Desktop/TestSpinFigs.R" # THIS FILE
    setwd(dirname(file)); # Set the directory to be where the file is
    spin(file, format = 'Rmd', report=F) # Make a Markdown version
    render(paste(substring(file,0,(nchar(file)-1)),"md",sep=""), pdf_document(toc = TRUE, toc_depth=6, number_sections= TRUE), 
           output_file = paste(substring(file,0,(nchar(file)-2)),".pdf",sep="")) # Create the PDF
#+

Renders a pdf that looks like: rendered PDF

ThatGuy
  • 1,225
  • 10
  • 28

0 Answers0