Open samuelVJrobinson opened 3 years ago
Check out the kbl
function in the latest version of this package. I think it will solve this issue. Let me know if it works. Otherwise, you can just load those packages in header_includes.
I tried kbl
instead of kable
, and I encountered the same problem.
These reports all compile fine as long as they are run first in the loop, which makes me think that something about the knitting environment changes on each pass. However, this problem remains even when I specify envir=env.new()
in render
, so there's something else going on that I don't understand.
Loading the necessary packages using header_includes
fixes the problem, although it's a matter of trial and error to figure out which ones are required.
Hello,
I'm running into a problem when trying to generate parameterized reports while using kableExtra. This requires a template Rmd file:
Section 1
Here is the report for my client
r params$client
:Make reports for a set of clients using a for-loop
library(rmarkdown)
clients <- c('Larry','Moe','Curly Joe') #Names of clients datList <- list(mtcars,CO2,iris) #Dataset for each client
for(i in 1:length(clients)){ pdfName <- paste0(clients[i],' report.pdf') #pdf filename render(input='template2.Rmd',output_file=pdfName,params=list(client=clients[i],newdata=datList[[i]])) }
> processing file: template.Rmd
> output file: template.knit.md
> /usr/bin/pandoc +RTS -K512m -RTS template.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc9dcf1e93ea9e.tex --lua-filter /home/samuel/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/samuel/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in' --include-in-header /tmp/RtmpLnpKUX/rmarkdown-str9dcf2a47bab2.html
>
> Output created: Larry report.pdf
> processing file: template.Rmd
> output file: template.knit.md
> /usr/bin/pandoc +RTS -K512m -RTS template.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc9dcf1e61dca6.tex --lua-filter /home/samuel/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/samuel/R/x86_64-pc-linux-gnu-library/3.6/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable 'geometry:margin=1in'
> ! LaTeX Error: Unknown float option `H'.
> Error: LaTeX failed to compile Moe report.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Moe report.log for more info.