Unable to compile R code into PDF document

I am trying to knit a document from RStudio to pdf, but I am getting the following error (attached). I have made a MWE that replicates my problem. This is on Windows 10 Pro with Rstudio 2022.12.0 and R 4.2.2

TexLive 2022, Pandoc and TinyTex have been installed.

Any help in getting this working would be appreciated.

require(tidyverse)

a <- mtcars

g <- a %>% 
  ggplot()+
  aes(x = mpg,
      y = wt)+
  geom_point()
print(g)
processing file: test.spin.Rmd
                                                                                                            
output file: test.knit.md

"C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS test.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --lua-filter "C:\Users\ParmeshGajjar\AppData\Local\Programs\R\R-4.2.2\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\ParmeshGajjar\AppData\Local\Programs\R\R-4.2.2\library\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" 
! LaTeX Error: Unicode character ^^[ (U+001B)
               not set up for use with LaTeX.

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
Execution halted

See answer in documentation

You need to change the default PDF engine if you are using Unicode characters in your document

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.