Rmarkdown tabu.sty error in PDF output with libraries - r

Hello R community i'm trying to knit a pdf document, but get an error and cannot find the right answer in any forum. I'm using the latest R(4.1) and Rstudio(1.4). I have MiKTeX installed but I can not get a pdf to write unless I changed the global setting in R to write from tiny tex.
I have isolated the problem in the script. If I try to knit the document without loading any libraries, the document WILL knit. If I try to knit with libraries, then I throw a tabu.sty error. The problem here is I need the libraries for tables, graphs, etc.
! LaTeX Error: File `tabu.sty' not found.
! Emergency stop.
<read *>
Error: LaTeX failed to compile Chapter0.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Chapter0.log for more info.
Execution halted```

Related

R MarkDown Error: pandoc version 1.12.3 or higher is required and was not found

I'm using R Studios Cloud but I am suddenly experiencing difficulty knitting my markdown in any format (html, pdf & word).
This is the error I'm thrown when I press the knit button:
pandoc version 1.12.3 or higher is required and was not found (see the help page ?
rmarkdown::pandoc_available).
Execution halted
I then check if pandoc is installed via pandoc_available():
> pandoc_available()
[1] FALSE
False, so I try to install pandoc again? (I do not recall uninstalling it)
> installr::install.pandoc()
sh: 1: ifconfig: not found
Error in system("ifconfig", intern = TRUE) : error in running command
However, again I get another error for ifconfig: not found.
I am new to learning R and programming as a whole. I'm quite stumped. I have checked recent threads including popular solutions (linked below) to no avail.
I have also tried opening a new markdown file but still could not get knit to work.
I'd appreciate any help on this one.
popular solution to resolve pandoc version 1.12.3 error
Found the solution.
Relaunch your project by clicking on the 3 dots in the upper right corner.
See thread here.
Seems to be a common error happening to a lot of r studio cloud users in the past 24 hours.

I can't knit my documents into PDF in RStudio

I have to use RStudio to knit a report in PDF but when I try to knit the document with the packages required in a chunk in Rmarkdown it shows me this error:
tlmgr search --file --global '/multirow.sty'
tlmgr: Remote repository is newer than local (2018 < 2019)
Cross release updates are only supported with
update-tlmgr-latest(.sh/.exe) --update
Please see https://tug.org/texlive/upgrade.html for details.
! LaTeX Error: File `multirow.sty' not found.
! Emergency stop.
<read *>
Errore: Failed to compile questionario_sulla_responsabilita_222222.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See questionario_sulla_responsabilita_222222.log for more info.
Inoltre: Warning message:
In system2("tlmgr", args, ...) :
running command ''tlmgr' search --file --global '/multirow.sty'' had status 1
Execution interrupted
how can I fix this? I am using a MacBook Pro
I tried to updated everything I can and I've tried to install everything from the beginning but it jeeps showing me the same error message
To wrap the comments to the question up and following the solution at Yihui Xie's page - see also here for a discussion.
In short ...
tinytex::reinstall_tinytex()
... should do the trick.
Explanation: It seems that {tinytex}/Texlive is using a rolling package repository that moves to a new version each year while the local installment does not. The reinstallation does move the local installment forward.
An alternative solution: There seems to be an alternative solution that involves making the TexLive package repo un-rolling - i.e. using a fixed version - which might help: link

knit2pdf failing to produce pdf in Shiny Apps

As the title states, I am attempting create a shiny application that can generate a pdf file that a user can then download. (Note that this is not a duplicate question because I have not found a question with a similar error)
In my search for a solution, I found this gist by the Knitr package author: https://gist.github.com/yihui/6091942, which I am attempting to recreate. There are also questions on S.O that use the same code, out = knit2pdf('input.Rnw', clean = TRUE) but all of them seem to date to before the 3.2.3 release of R.
The error I am given is:
output file: input.tex
Warning: running command '"pdflatex" -interaction=nonstopmode "input.tex"' had status 1
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
unable to run 'pdflatex' on 'input.tex'
Warning: Error in texi2dvi: unable to run 'pdflatex' on 'input.tex'
Stack trace (innermost first):
52: texi2dvi
51: tools::texi2pdf
50: knit2pdf
49: download$func [D:...\App-2/server.R#44]
1: shiny::runApp
What I have tried so far:
Updating R, RStudio, knitr package and my TeX distribution (TeXLive). I know that TeXLive is not the issue as I use it daily, and I can create a dummy .Rnw that will compile perfectly using the Compile PDF button in R Studio. I have also tried using knit() or render() and those will generate .tex files without giving an error. I have also changed my working directory to the app folder as suggested by another S.O. question, but that didn't solve my problem either.
Edit, Additional information: I am using Windows 10
Any suggestions welcome!
I don't think TeXLive is working completely. On Windows, RStudio recommends using MiKTeX, and so does Pandoc.

New error when knitting get_engine(options$engine)

I have an .Rmd file that previously had knitted without any problems. Now I am getting the following error when executing this instruction
confusionMatrix(prediction1, ssTesting$classe)
The error is
Error in get_engine(options$engine) : Unknown language engine 'test' (must be registered via knit_engines$set())
If I execute each chunk independently the error does not occur.
It only happens if I knit.
The error is independent of using version R-3.1.2 or R-3.2.1. I also set all the cache options to FALSE and made sure that all the libraries were correct but the error keeps appearing.
A simple typo in the beginning of the chunk ... ```{rtest.mod1} instead of ```{r test.mod1}
Hard to see but simple to fix.

Error with knitr on texmaker

I am trying for the first time to get knitr running on texmaker, I followed this documentation and I am on Windows 7. However, when I compile, I get the following error stack:
Process started
Error in readLines(if (is.character(input2)) { : cannot open the connection Calls: <Anonymous> -> knit -> readLines
In addition: Warning message: In readLines(if (is.character(input2)) { : cannot open file 'try_easy.Rnw': No such file or directory
Execution halted
Process exited with error(s)
I tried to google it, but only found references to linux/unix, which were not helpful for my case. Following is my short test document:
\documentclass[a4paper]{article}
\begin{document}
<<a>>=
x=rnorm(100)
<<b>>=
<<a>>
mean(x)
#
\end{document}
It's my first time on stackoverflow, so please tell me if you need more information or I did something wrong. Thank you very much.
Update
Hello everyone,
I managed to find out my mistake. For the sake of future google-searchers, I had saved the file as a .tex instead as .rnw. Saving as rnw solved it. Since I cannot answer my own questions, I edit it here.
This error happens when the file is saved as a .tex instead of a .Rnw, as the compiler does not know that he should "knitr-compile" files that have the .tex handle, unless you specifically set him up like that.

Resources