I was running the check for my package that I have created when I got this error due to some example file that has been created outside my package directory which has been created due to the vignette I have created because while checking when R was reading the vignette, it got this error and I tried to delete the folder that has been created outside my package directory but I am not able to. Here is the error that is shown while checking the package:
E checking examples ... Running examples in 'ikpack-Ex.R' failed
Warning in file(con, "r") :
cannot open file 'ikpack-Ex.Rout': Permission denied Error in file(con, "r") : cannot open the connection Execution halted
Any kind of help related to this is appreciated.
Related
I am getting an error when trying to utilize any installed packages.
Here is the code I use.
install.packages("tidyverse")
> library(tidyverse)
Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") :
cannot open compressed file 'C:/Users/M/Appdata/Local/R/win-library/4.2/vctrs/R/vctrs.rdx', probable reason 'No such file or directory'
Error: package or namespace load failed for ‘tidyverse’:
unable to load R code in package ‘vctrs’
I have tried the following:
restarting R Studio
re-installing R Studio
downloading the packages and putting them in wd()
tried moving the wd()
appreciate the help
After installing the tensorflow package for R from Github, and loading with library(tensorflow), when doing install_tensorflow(), I get the error message below. I don't know how to get it to find the file or where I can even know where the file is. Thanks
install_tensorflow()
Using virtual environment '~/.virtualenvs/r-reticulate' ...
sh: /Users/emmeran/.virtualenvs/r-reticulate/bin/pip: No such file or directory
Error: Error installing package(s): 'pip'
In addition: Warning message:
In system2(pip, args) : error in running command
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.
I am having a problem I think I may be able to solve my if I could deinstall 'ggplotly' before attempting to reinstall it.
Here's what happened:
Code that worked fine when an instructor demoed it, failed when I tried it at home. It was R Markdown. Investigating the problem code cell line by line, the problem was centered around ggplot2 (which uses ggplotly). Code and error messages are provided below. In the code "graph" was a ggplot2 facet_wrap() that was supposed to pass into ggplotly.
Here is the excerpt from my console of the problem and a failed attempt to fix it by re-installing:
> ggplotly(graph)
Error in dev_fun(tmpPlotFile, width = deviceWidth, height = deviceHeight) :
unable to start png() device
> ggplotly(graph)
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
In addition: Warning messages:
1: In grDevices:::png("C:/Users/User/AppData/Local/Temp/Rtmp0ar20f/3b613ba7d0ce4228bc937aee7cfcb112.png", :
unable to open file 'C:/Users/User/AppData/Local/Temp/Rtmp0ar20f/3b613ba7d0ce4228bc937aee7cfcb112.png' for writing
2: In grDevices:::png("C:/Users/User/AppData/Local/Temp/Rtmp0ar20f/3b613ba7d0ce4228bc937aee7cfcb112.png", :
opening device failed
> install.packages("plotly")
Error in install.packages : Updating loaded packages
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file 'C:\Users\User\AppData\Local\Temp\Rtmp0ar20f/libloc_190_4464fd2b.rds', probable reason 'No such file or directory
As per comments on this thread, a package can be de-installed with remove.packages. As per the original problem on this post, de-installing and re-installing cleared it, but for completeness, here are all the precautions I took to improve the chances of this working:
removed the package as indicated
re-initialized RStudio (exited without saving the workspace and re-entered it)
By default, it remembered some of my environment so I clicked the broom icon to clear out all variables and data from memory
re-installed the package
re-loaded the original R file and tested to make sure all worked as expected.
This is what I saw in the console with de-installing and re-installing in contrast to the messages shown on the original post:
During de-installation:
> remove.packages("plotly")
Removing package from ‘C:/ProgramFilesCoders/R/R-3.3.2/library’
(as ‘lib’ is unspecified)
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning message:
In gzfile(file, mode) :
cannot open compressed file 'C:\Users\User\AppData\Local\Temp\Rtmp0ar20f/libloc_190_4464fd2b.rds', probable reason 'No such file or directory'
During re-installation:
> install.packages("plotly")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/plotly_4.5.6.zip'
Content type 'application/zip' length 817502 bytes (798 KB)
downloaded 798 KB
package ‘plotly’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpGco6OK\downloaded_packages
I am trying to download the zoo package to work with time series using:
install.packages("zoo")
but I get the following message:
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.12
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.12
Warning messages:
1: In open.connection(con, "r") :
unable to connect to 'cran.r-project.org' on port 80.
2: In getDependencies(pkgs, dependencies, available, lib) :
package ‘zoo’ is not available
I tried several different mirrors and I keep getting the same error... Is zoo just not available in most mirrors or is something going wrong?
Please see FAQ 2.19. Or, alternatively, a quick search for "unable to connect to 'cran.r-project.org' on port 80" on rseek.org.
Reading the FAQ and doing a search for the error will usually help you resolve most issues.