Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205399

Compile Multiple PDF using RMarkdown LaTex Error

$
0
0

I am trying to automatically compile multiple individual PDF reports from RMarkdown using a for loop in a separate R script. It works perfectly using this example that I previously posted here.

Sample df:

       Athlete       Date Jump Sprint Bench
1    Jones_Bob 12.18.2019   25  4.567   100
2  Taylor_Fred 12.18.2019   32  4.687    98
3    Smith_Joe 12.18.2019   31  4.988    97
4 Reeves_Frank 12.18.2019   27  4.765    90

I am now doing a very similar type process but am compiling by athlete instead of by hub. However it compiles for the first 1-2 athletes and then stops with this error:

! Undefined control sequence.
<argument> ... }l||l|>{\centering \arraybackslash 
                                                  }p{1.2cm}|>{\centering \ar...
l.101 \end{tabular}}

Error: Failed to compile report.Lastname_firstname.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See report.Lastname_firstname.log for more info.
> 

This is the r script for loop:

for (athlete in unique(WHOC_DB$Athlete)){
  subgroup <- subset(WHOC_DB, Athlete == athlete)
  render("Ind_Hockey_Report.rmd",output_file = paste0('report.', athlete, '.pdf'))   
}

This is my YAML in the RMarkdown doc plus some additional code that was suggested in threads with similar issues:

---
title: "WHOC Report Dec 2019"
output: 
  pdf_document:
classoption: landscape
geometry: margin=.8cm
---
options(tinytex.verbose = TRUE)

I've also tried updating my tinytex via this to no avail:

update.packages(ask = FALSE, checkBuilt = TRUE)  # update R packages
tinytex::tlmgr_update()  # update LaTeX packages

I'm not sure why I can compile multiple PDFs from the previous hyperlinked post but not this one. I'm still relatively new to R so am not sure how to de-bug or understand error messages. Appreciate any thoughts!


Viewing all articles
Browse latest Browse all 205399

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>