roxygen2 4.0.1 fails when man/figures is present - r

In an R package, I have a figure (jpeg) located under man/figures, which is added to a Rd file with,
\if{html}{\figure{supplydemand.jpg}{Supply-demand}}
\if{latex}{\figure{supplydemand}{Supply-demand}}
After updating to roxygen2 4.0.1, I get the error:
==> roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))
Error in file(con, "r") : cannot open the connection
Calls: suppressPackageStartupMessages ... <Anonymous> -> first_time -> vapply -> FUN -> readLines -> file
In addition: Warning message:
In file(con, "r") : cannot open file './man/figures': Permission denied
Execution halted
Exited with status 1.
If I remove the code to insert the figure, I still get this error. Only when I remove the subdir man/figures does roxygen2 work OK.
I assume this is a bug in roxygen2 or is there a workaround?

Related

How do i fix this knitting error (loadnamespace) and "Error in contrib.url(repos, "source"))?

I have been trying to knit I first got an error but then fixed it on the same line. However, I know keep on getting alternative errors, one
Error: package or namespace load failed for ‘vctrs’ in loadNamespace and in 'hevaan'.
And if I am not getting that error I am getting this
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
Execution halted
However, I fixed these issues with install.packages and it went to 80% of my knit but now it will not go passed 5%.

Knitting error and dont know how to fix it

I am trying to knit and I keep getting this error:
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> install.packages -> contrib.url
In addition: Warning message:
In eng_r(options) :
Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.
Execution halted

Unable to knit R markdown

The following error is shown when I try to knit my r markdown baring in mind all code runs successfully otherwise.
Error in as.ts(x) : object 'Trainingdatar2000_m' not found
Calls: <Anonymous> ... withVisible -> eval -> eval -> acf -> na.action -> as.ts
In addition: Warning messages:
1: In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
2: In has_crop_tools() :
Tool(s) not installed or not in PATH: pdfcrop, ghostcript
-> As a result, figure cropping will be disabled.
Execution halted```
R Markdown evaluates in its own clean session. Your notebook needs to generate all datasets needed, and will not share objects in the parent session.

R - Installation of shiny fails after upgrade to 4.0.2

I upgraded to R 4.0.2 today, and also updated my copy of RStudio. While I've been updating my packages I've found that shiny won't install. Whenever I try to install shiny I get the following message...
Error in as.list.environment(base::getNamespace("shiny"), all.names = TRUE) :
lazy-load database 'H:/My Documents/R/win-library/4.0/shiny/R/shiny.rdb' is corrupt
Calls: <Anonymous> ... withCallingHandlers -> <Anonymous> -> <Anonymous> -> as.list.environment
Execution halted
*** arch - x64
Error in as.list.environment(base::getNamespace("shiny"), all.names = TRUE) :
lazy-load database 'H:/My Documents/R/win-library/4.0/shiny/R/shiny.rdb' is corrupt
Calls: <Anonymous> ... withCallingHandlers -> <Anonymous> -> <Anonymous> -> as.list.environment
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'H:/My Documents/R/win-library/4.0/shiny'
Warning in install.packages :
installation of package ‘shiny’ had non-zero exit status
I get this error regardless of whether I just type "install.packages('shiny')" and peace out or if I download the tar.gz and try to install from a local directory. The same error happens when I specify to download an older version of shiny, so I'm pretty sure it's not a problem with the file I'm trying to install. Restarting RStudio does nothing, which is the only advice I could find online for shiny installation problems.
Has anyone else had any problems with installing shiny since upgrading to the newest version of R? Any workarounds?

Roxygen getting cannot open file/permission denied/execution halted

So I've been trying to build and load a package and have been getting this error
devtools::document(roclets=c('rd', 'collate', 'namespace'))
Updating stat290.ass2 documentation
Loading stat290.ass2
Error in file(con, "r") : cannot open the connection
Calls: suppressPackageStartupMessages ... topic_add_examples -> read_lines -> <Anonymous> -> file
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\Users\blah\Desktop\stat290.ass2': Permission denied
Execution halted
Exited with status 1.
I've seen these posts as reference: Roxygen Warning "cannot open the connection" "Permission Denied", https://github.com/klutometis/roxygen/issues/766, but they say the error has been patched out. I have tried deleting and re-installing both devtools and roxygen2, but have not had any luck
I resolved this issue by removing the #return and #example in my roxygen2 comments at the header of the function as I did not write anything in for them. It appears that if you put a #XXX you need to fill in the information next to it, otherwise the key is missing the value and it bombs.
I got he idea from the error topic_add_examples -> read_lines -> since it appeared it was trying to read the comments next to my #example but I didn't have any.

Resources