I have done everything I could: Reinstall R, Rstudio, MikTex, installes tinytex package.... but no luck.
Aparrently the issue is with the function cisim included in the PASWR2 package. This image shows the graph that cisim generates, which is the one that gives problems
Could you add a little example dataset and code for just the part of the .Rmd document that is causing the problem. If you haven't ever made a reproducible example (i.e., reprex) before, you can get some ideas here:
Based on questions and answers I saw here and here that I found from searching the error message, I'm guessing this is somehow related to latex.
I think you're actually close to a reprex. You should provide the code in your question instead of a screenshot so someone who wants to help can copy and paste directly into R.
Since you are asking a question about a RMD, you should also include information in the YAML header so we can see what kind of document your are making.
It looks like the problem has to do with the message that prints as R output from cisim(), not the plot. (If you knit to a HTML you can see that the message prints oddly, which made me wonder if this was the problem).
This is apparently output, though, and not a message per se, so message = FALSE in the chunk header didn't help.
This message can be suppressed by suppressing the output with results = "hide". You still get the plot, though. This allowed me to knit to a PDF without error.
I was seeing the same error messages about the Unicode character, so I knew that somewhere there was a character that wasn't being recognized.
I thought the problem involved the plot text because I didn't really notice the text output, but when I knit the same thing to an HTML document the text output that cisim() prints had weird symbols in it.
7 % of the random confidence intervals do not contain Var = 1 .
Since those weird symbols showed in the text output, I thought I'd see what happened if I suppressed the text output. The results chunk option is relevant to text output. You can see important info on Chunk Options here.
results : ( 'markup' ; character) takes these possible values
markup : mark up the results using the output hook, e.g. put results in a special LaTeX environment
asis : output as-is, i.e., write raw results from R into the output document
hold : hold all the output pieces and push them to the end of a chunk
hide (or FALSE ): hide results; this option only applies to normal R output (not warnings, messages or errors)
Hiding the text output means the weird symbols aren't printed and, voila, no latex error. I'm guessing there is a way to get latex to print that symbol if we knew what it was but since the same text output is actually on the plot this is a relatively simple way to fix the problem.
You could consider reporting this to the package maintainers (I didn't check if they have an issue tracker) in case they want to look into it further so this doesn't happen to others.
Don't forget to mark you question solved answered (if it has been):