I have several learnr tutorials running on a shiny server. After updating rmarkdown to version 1.11 I get the following error message whenever there exists a prerendered HTML file:
Error in file.exists(dep$src$file) : invalid 'file' argument
Calls: ... shiny_prerendered_html -> shiny_prerendered_prerender -> file.exists
Execution halted
Versions 1.9 and 1.10 work fine.
Any idea/help would be highly appreciated!
I did not manage to produce a short example - all partial files seem to work. A full file can be downloaded here
I also have the same problem, a very quick and dirty solution is to delete the index.html file before each new render, but hoping for a more structural solution.
Related
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'm trying to publish an R Shiny app. It works when run locally, but once published to shinyapps.io produces the following error.
Warning in gzfile(file, "wb") :
cannot open compressed file '/key.rda', probable reason 'Permission denied'
Error in value[[3L]](cond) : cannot open the connection
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
You can also see the actual page with the error here: https://povertylab.shinyapps.io/ACS-Map-Dashboard/
Though I have tried to reproduce this error it doesn't appear when I publish other apps, and my searches haven't turned up anything. Other things I've tried: publishing from other computers, publishing only global.R, server.R, and ui.R files, and copying files to a new project and publishing from there.
You can find all code for the app here: https://github.com/Poverty-Lab/ACS-Map-Dashboard
I would appreciate any input, even if it's just guidance on what gzfile is and what the error message could mean. Thank you!
Where is the key.rda file supposed to be? I've looked through your repo and I don't see it, which is probably causing the "cannot open the connection" error.
As a side note, you should probably ignore the .Renviron file; right now anyone can use see and use your key. Make sure you remove it from the history as well.
Thanks all. Turns out this was a problem with the way we were handing the api key for the acs package. We were using api.key.install to install the api key inside the app, and one of api.key.install's default arguments is file = "key.rda", and that file apparently could not be found. I'm still not sure why this problem only came up when we published the app, but we got around it by supplying the actual api key to the acs.fetch function in server.R.
I am developing an R app and came up with a workaround to integrate testthat in it (it usually requires your project to be a package) by adding a DESCRIPTION file to the project root.
I got this method from a colleague who managed to get it to work like this.
The problem is, when I try to test anything (even empty test files), I get this error:
Error in x[[method]](...) : attempt to apply non-function
Calls: <Anonymous> ... <Anonymous> -> o_apply -> lapply -> FUN -> <Anonymous>
Execution halted
What I know is that this appears only on macOS. My colleague can still run this app without problems on Windows.
What's the deal with it?
The MCVE for reproducing this error would be:
create a minimum DESCRIPTION file with content:
Package: testpckg
add testthat to your project:
usethis::use_testthat()
usethis::use_test("foo")
create empty file bar.R
in test-foo.R, source bar: source("bar.R")
RStudio Version 1.1.447,
R version 3.4.4, Mac OS X 10_13_4
This appears to be due to a bug in testthat 2.0.0. Adding a context("Name of test context") to the top of each test file worked for me (tested using Ubuntu and Windows).
This question is a corollary of my attempts to get some experience with creating reproducible reports from R Markdown documents via knitr and rmarkdown R packages. While it seems that .Rmd => HTML conversion is automated from within RStudio (Knit HTML button), my attempt to do the same outside of RStudio (Rscript -e 'library(rmarkdown); render("knitr-example-slides-1.Rmd")') failed due to, according to the message, lack of pandoc on my system. This is most likely false, since RStudio somehow managed to perform the conversion. Therefore, it is most likely an access and/or path issue.
Without knowledge of where RStudio maintains pandoc and details about the access, I have decided to install pandoc myself. Unfortunately, sudo apt-get install pandoc has not been very helpful, due to the fact that current version of pandoc in Ubuntu's trusty repository (14.04LTS) is 1.12.2.1. According to rmarkdown's message, version 1.12.3 or higher is required. "Not a big deal", I have thought, and followed instructions on installing pandoc in case of too old version in repository (http://johnmacfarlane.net/pandoc/installing.html). That requires installing the Haskell platform, which is pretty big and which output is rather verbose. After some time, I finally has been greeted with the following failure message:
[ 6 of 57] Compiling Text.Pandoc.Readers.TeXMath ( src/Text/Pandoc/Readers/TeXMath.hs, dist/build/Text/Pandoc/Readers/TeXMath.o )
src/Text/Pandoc/Readers/TeXMath.hs:30:38:
Ambiguous occurrence `readTeXMath'
It could refer to either `Text.Pandoc.Readers.TeXMath.readTeXMath',
defined at src/Text/Pandoc/Readers/TeXMath.hs:56:1
or `Text.TeXMath.readTeXMath',
imported from `Text.TeXMath' at src/Text/Pandoc/Readers/TeXMath.hs:33:1-19
(and originally defined in `Text.TeXMath.Parser')
Failed to install pandoc-1.12.4.2
cabal: Error: some packages failed to install:
pandoc-1.12.4.2 failed during the building phase. The exception was:
ExitFailure 1
pandoc-citeproc-0.3.1 depends on pandoc-1.12.4.2 which failed to install.
Firstly, I'm not sure how to fix it. Secondly, I very much suspect that there should be an easier way to enjoy generating reproducible reports with rmarkdown and pandoc than this. Your advice will be appreciated!
UPDATE (see comments):
Rscript -e 'library(rmarkdown); render("knitr-example-slides-1.Rmd")'
processing file: knitr-example-slides-1.Rmd
|....... | 11%
ordinary text without R code
|.............. | 22%
label: setup (with options)
List of 1
$ include: logi FALSE
Quitting from lines 6-8 (knitr-example-slides-1.Rmd)
Error in eval(expr, envir, enclos) : object 'opts_chunk' not found
Calls: render ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted
Basically, #daroczig answered this question in his comment above, so I will repeat it here, plus will add an answer to the relevant minor question on the issue, appeared after the main question's issue fix.
1) "A binary compiled version of Pandoc is already shipped with RStudio, so you can simply create a symlink, so that you could easily use that outside of the RStudio eco-system: https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md#newer-systems-debianubuntufedora";
2) I have fixed the error, experienced after applying the advice above (see my comment), by calling opts_chunk() using explicit package reference: knitr::opts_chunk(), following guidelines here: http://rmarkdown.rstudio.com/authoring_migrating_from_v1.html (thanks to #Yihui for pointing me to this document in a different question: Transitioning research project to knitr-based setup).
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.