R package `exams` - not importing R markdown - r

I recently installed the R package exams in order to generate some qti format quizzes for a course I am about to teach, but have been unable to import R markdown files.
I tried with the example file switzerland.Rmd available here:
http://www.r-exams.org/templates/switzerland/
Here's the error I am getting when I try to run exams2qti21:
> exams2qti21("../Downloads/switzerland.Rmd")
sh: 1: +RTS: not found
Error: pandoc document conversion failed with error 127
How can I fix this?
I am running R 3.4.4 on Ubuntu Xenial.

This error does not come from exams itself but from the rmarkdown package which is leveraged by exams to call the pandoc converter (for converting Markdown to HTML in this case). It appears that on your system pandoc is either not installed at all, not in the search path, or not installed correctly.
If pandoc is not installed at all, then you need to install it. On Ubuntu you can use the usual package managers to install it, e.g., sudo apt-get install pandoc or via synaptic etc. If you use RStudio then this also ships with a pandoc binary (at least on Windows) so that you don't need to install it yourself.
To check at which path pandoc is installed (if it is), you can use rmarkdown::pandoc().

Related

InstallationWarning: package 'XYZ' is in use and will not be installed: R

I am trying to install package SBCK from R build using Rscript build.R -c -v -i in windows command prompt following the steps given here. However, I ended up with package SBCK being not installed because of following error/warning InstallationWarning: package 'SBCK' is in use and will not be installed. I have no package with name SBCK installed on my system, so I do not understand why I am getting this warning message and thus not to be able to install the R package.
I know that similar question have been asked before here but solution there does not work in my case.
I am using R version 4.2.0 on Windows 10.
Once 'build.R' is run, "SBCK_0.5.0.tar.gz" is created in the 'SBCK-R' folder.
You can now install it via the package archive file option or pointing to that file in the install.packages command. I faced the same issue and this solved it.

RStudio error in windows: Running pdflatex.exe on file_name.tex.. (exit code -1073740791)

I am using Rstudio in windows 10. I am triying to create a pdf from a .tex file. However, when I compile the PDF, the following error appears:
Running pdflatex.exe on file_name.tex...failed Error running C:/Users/user_name/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)
I am using a native installation of R, Rstudio and MikTeX. Not an envioronment with anaconda or similar.
If you are using RStudio, have you tried tinytex instead of MikTeX? In the Tools Menu>Global Options>Sweave, tick "use tinytex for compiling .tex files". Then install tinytex package. After installing tinytex package, write in console "tinytex::install_tinytex()". This will install the latex compiler tinytex. Try compiling your tex file using it.
I think that issue has to do with missing packages. In fact, MiKTeX doesnt preinstall most of them. I recommend to compile with TinyTeX, because it shows where the compilation stops (as I said, due to a missing package typically required in some sty file). This way you can track which are the missing packages and install them on the MiKTeX Console one by one.
I posted about this issue in an open discussion on Github. Drop the link here in case you need more details.

R Notebook with dlookr package

I try to create Data summary with dlookr package. In normal R it works but in R notebook it has a notification like this:
Error: pandoc document conversion failed with error 251
Anybody knows why?
Pandoc is a program that R Studio relies on to create html files. You may be required to download (https://github.com/jgm/pandoc/releases/tag/2.4) and install (instructions here: https://pandoc.org/installing.html) the pandoc program on your computer. I would also recommend downloading and install MiKTeX (mentioned on the pandoc install page mentioned above; see here: https://miktex.org/) which will allow you to create pdf files.

Command line equivalent to "Run Document" for R versions >= 3.2.2 so that markdown files can access the global environment

I am making an interactive R Markdown report, with Shiny providing the interactivity. I am having a problem where I cannot access variables in the global environment when I click "Run Document" in RStudio (as described here). That same sections describes how you can use rmarkdown::run(...) to run the document from the command line, and this question shows that this allows the report to access variables in the global environment.
However, for my version of R I get the following error in the pop up window:
Error: pandoc version 1.12.3 or higher is required and was not found.
When I try and install pandoc, I get:
> install.packages("pandoc")
Warning in install.packages :
package ‘pandoc’ is not available (for R version 3.2.2)
Is there a fix for this?
pandoc isn't a R package. It's something you need installed on your system. RStudio provides it if you don't have it installed. Updating RStudio should fix the issue if you don't want to install pandoc manually.

Knitting to PDF in R

I am new to R and am trying to knit my R Markdown files into PDF format.
I continually get the error message:
pandoc: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed with error 41
Execution halted
No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:
Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup
(NOTE: Be sure to download the Complete rather than Basic installation)
Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/
(NOTE: Download with Safari rather than Chrome strongly recommended)
Linux: Use system package manager
I have downloaded pandoc, and I have also downloaded TexLive and have installed them both onto my computer. For the life of me I cannot figure out why R wont recognize that Ive installed them, and knit into a PDF.
Please help!
For Mac OS X, if you have installed TexLive (I installed so through homebrew caskroom) you should have pdftex available via command line.
type 'which pdftex' to make sure something shows up. from there, i created a symbolic link into my $PATH, specifically into my /usr/local/bin (which is where all my homebrew stuff is stored) with:
ln -s /usr/texbin/pdftex /usr/local/bin/pdflatex
from there, using knitr in RStudio and R in general seemed to work and rendering R Markdown is definitely a really beautiful option (check some of the templates too like the Tufte one!)
I had the same problem, after downloading mactex through FireFox and installing the package.
I quit and restarted RStudio, and it worked (no changes at the terminal command line level).
The .pdf output is, however, a bit blurry at least on my first attempt.
I had a similar issue as I wasn't able to knit pdf file & solved it by installing & running tinitex packages using those commands in the console -- not the terminal
install.packages("tinytex")
tinytex::install_tinytex()

Resources