R Markdown Saved on Dropbox won't compile - r

I am trying to compile the basic example R markdown beamer presentation (I also tried compiling the pdf and the html, neither of which worked).
It works flawlessly when I save the markdown file on my local mac book air. But when I save the file on my dropbox, I get the following error:
Loading required namespace: ffbase
Error in .First() : could not find function "load.ffdf"
Execution halted
The example file does not call ffbase in any way. I think the problem has something to do with accessing my rprofile, but I can't figure out why that would be an issue.
How do I get the markdown file to knit the pdf/html/beamer when the script is saved on dropbox?

Related

tinytex not finding tabu.sty when downloading PDF for the first time

I am generating a PDF r markdown document as part of a downloadable report in a shiny application using download handler. I am using the tinytex package.
Once published to RStudio Connect though if I try and download I am getting an error that states that tabu.sty cannot be found and it errors. If though I then download again straight after the PDF is published and downloaded without any issues. Any thoughts as to why this may be happening? The same thing occurs in rstudio but with a different sty file (multirow.sty). I use neither tabu or multirow in my markdown documents.

Compile error of TeX in .rmd file to create .html

I made a .rmd file for a vignette containing TeX scripts for my package.
My procedure
Make a vignette as .rmdfile.
Make a .htmlfile by the R script devtools::build_vignettes() or devtools::document()
Open the resulting .html file via web browser [Chrome]
I found that the tex script is raw in web browser page, that is, it is not compiled yet.
Why does such phenomenon occur ? Now, compile goes well, but a few hours ago, it failed.
Does the following relate ?
> devtools::build_vignettes()
Building mypkgName vignettes
Warning message:
In system(paste(cmd, "-n")) : 'make' not found
Movin aaa.html, bbb.html, ccc.html, aaa.R, bbb.R, ccc.R to doc/
Copying aaa.Rmd, bbb.Rmd, ccc.Rmd to doc/
Building vignette index
Most raw LaTeX and raw HTML is just passed through Pandoc without changes. There are some exceptions: math in dollar signs (e.g. $x^2$) will be handled by MathJax, which can handle a subset of LaTeX.
Even if you're dealing with this subset, you will see what looks like raw LaTeX if MathJax can't run. This could happen if you have Javascript turned off in your web browser (maybe by NoScript), or if you can't connect to the MathJax website and haven't asked to reference a local copy of MathJax.

Getting error message in R Markdown KNITR

I am getting a very strange issue when using R-Markdown and when I press KNITR.
Each time I run the script I get the error below.
Error in read.csv(url("https://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.data.csv?geography=1249902593...1249909543&date=latestMINUS2-latest&sex=7&item=1&measures=20100")) :
could not find function "read.csv"
This code does not feature in my script and exists in another document that I had created. I have changed the folder directory, cleared the environment. Yet this annoying error keeps appearing when pressing KNITR. I have created a new file, directory everything yet it keeps appearing.
I would be grateful for any pointers.
Try to run read.csv from utils package as shown
utils::read.csv(url("https://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.data.csv?geography=1249902593...1249909543&date=latestMINUS2-latest&sex=7&item=1&measures=20100"))
or
library(utils)
read.csv(url("https://www.nomisweb.co.uk/api/v01/dataset/NM_1_1.data.csv?geography=1249902593...1249909543&date=latestMINUS2-latest&sex=7&item=1&measures=20100"))

Ubuntu 16.04 and Rmarkdown in RStudio 1.0.143 - plots are saved as blank images, how to debug?

I created a big document that properly compiled to LaTeX / PDF some time ago...
But now, when I click on 'Knit' button in Rstudio (to compile it to PDF), during compilation I see following error messages in case of each figure chunk:
!!! Error: Ghostscript exited with error code 1!
As a result, in created PDF, all plots are empty. They have proper captions, but all images are blank. As I check, all images are empty.
BUT when I try to execute following code from the console:
Rscript -e "library(knitr); knit('myRmarkdown.Rmd')"
to change my .Rmd file into .md, I can see that images are properly generated and saved in 'figure' folder. I don't see any Ghostscript or other errors, so I assume that my .Rmd file is corrrect.
I checked that I have the latest Ghostscript (9.18~dfsg~0-0ubuntu2.6) for my machine.
How can I debug generation of PDF from my Rmarkdown file (sorry, but I can't share it) / obtain additional information what is going wrong? I don't know how to fix it / what to do next.

Can't open connection when shortcut-knitting in RStudio

I have a CSV file I made shared publicly via Google Drive. I used bit.ly to generate a nice short URL, and I can read it into R just fine via
read.csv("http://bit.ly/1pRClOk")
(It's a pretty small dataframe, 9x17, so don't be worried about trying it out.)
I put my code in in a .Rmd document, and I can knit it just fine from the console if I run knit("csvtest.Rmd"), but if I knit using the Knit HTML button in RStudio (Ctrl-Shift-K), I get
Error in file(file, "rt"): Cannot open the connection.
In general, I much prefer to knit using the shortcut, because doing so seems to knit in it's own R session which means I can be sure I'm not accidentally referencing something in my global environment. I'd also like to distribute the .Rmd file without having to explain to people that they need to explicitly knit from the console.
Is there a way I can make make the connection work when using the knit shortcuts?
I'm on Windows 7 and using current versions of RStudio (0.98.1091) and knitr (1.8).
MWE
Using this document saved as csvtest.Rmd. I can run the code in RStudio line by line, no problem, typing knit2html("csvtest.Rmd") produces an HTML document with the data. Knitting via shortcut produces the error above.
---
title: "Can knitr open connections?"
output: html_document
---
```{r}
reentry = read.csv("http://bit.ly/1pRClOk")
head(reentry)
```
If you only care about a solution under Windows, I believe you need to setInternet2(TRUE) in te Rmd file before you read the file, since it is essentially an HTTPS link, which you cannot read into R by default.
A more portable solution is to use the downloader package to download the file (you can download it to a tempfile()) before reading it.

Resources