I am trying to run an R script from the Windows Command Prompt but is running into the following error:
Error in library("dtw") : there is no package called 'dtw'
Execution halted
The code that I typed is just RScript ...R
The R script actually runs in RStudio, and the address returned from .libPaths() function contains the "dtw" package.
Anyone has any idea on how to fix this?
Related
I am trying to run R script that works fine when running in Rstudio in command prompt, the reason why is that later I want to run it in Talend ETL tool.
However when I run it in command I obtain the following error:
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: install.packages -> contrib.url
Execution halted
Any idea how to solve that?
Note: I tried to install the packages contrib.url or contriburl but it is not compatible with my version of R.
Thanks.
I am trying to call an R script from inside Python however in the 1st line of the R script I am calling the "lubridate" library which gives me the following error
Error in readRDS(pfile) : cannot read workspace version 3 written by R 4.0.2; need R 3.5.0 or newer Calls: library -> find.package -> lapply -> FUN -> readRDS Execution halted
After calling .libPaths() in Rstudio I find that the library directories are :
[1] "/zhome/c9/f/144817/R/x86_64-pc-linux-gnu-library/4.0" [2] "/appl/R/4.0.2-mkl2020/lib64/R/library"
However, I put the print(.libPaths()) command at the first line of my R script and then run Rscript from inside my Python code, and the path that gives me is the following:
[1] "/appl/R/3.2.2/lib64/R/library"
It seems that the .libPaths() sees different library directories when called from Rstudio and when called from inside Python withe the Rscript command.
Any advice here, how I could make it look to the right library location?
I am working on Mac OSX, using v3.6.3 of R and using renv. In Rstudio and R, I can load the libraries of my installed packages, e.g library(ggplot2) works. However when I run a script using Rscript I get the message
Error in library(ggplot2) : there is no package called ‘ggplot2’
According to this SO answer, I need to make sure that the value of
Sys.getenv('R_LIBS_USER') in R.exe
is the same as the value of
Rscript.exe -e ".libPaths()"
But the value is the same, both are pointing to the renv-system-library in my project folder.
So how do I fix this?
It may be better to specify the lib.loc in library call
library(ggplot2, lib.loc = '/path/where/library/is/located')
I managed to solve this. akruns answer was useful, it did not work, but pointed me incorrect direction. The answer did not work because using it, I received the following error:
Error: package or namespace load failed for ‘ggplot2’:
.onLoad failed in loadNamespace() for 'pillar', details:
call: utils::packageVersion("vctrs")
error: there is no package called ‘vctrs’
Now vctrs was in the '/path/where/library/is/located' so I think dependent packages were not being loaded from that path but the default for Rscript. Putting a print(.libPaths() in the script gave
"/usr/local/Cellar/r/3.6.3_1/lib/R/library"
instead of
[1] "/Users/Chris/Sites/app_name/renv/library/R-3.6/x86_64-apple-darwin18.7.0"
[2] "/private/var/folders/5_/p_yl0439059b7_jdqzrm0hr40000gr/T/RtmptdHcWN/renv-system-library"
for .libPaths() in Rstudio. Looking at the ruby program that was actually running the Rscript program, I found it was being run with the --vanilla option, i.e
Rscript --vanilla script_name
Removing the --vanilla option fixed the problem. I think that scripts with the --vanilla option stopped working because I reinsalled R using brew to fix another problem I was having and as part of this issued this command:
brew link --overwrite r
I am new in working with linux. I am trying to analyse sequencing data using dropEst pipeline https://github.com/hms-dbmi/dropEst#dropreport. I want to run the DropReport and for that I need to install dropEstR package.
I tried by :
devtools::install_github('hms-dbmi/dropEst/dropestr' , dependencies = T)
as they suggest and I get as an error:
bash: syntax error near unexpected token
`'hms-dbmi/dropEst/dropestr','
Do you have any idea what should I do differently?
I think you are using the "wrong" shell. You have to use R/RStudio, when you want to use the devtools package. From CRAN:
Title Tools to Make Developing R Packages Easier
I just tried you command in RStudio but installation fails in the end:
ERROR: dependency 'Rcpp' is not available for package 'dropestr'
* removing 'C:/R/R-3.4.2/library/dropestr'
Installation failed: Command failed (1)
You have to run such script on RStudio for R. Import your project here and run it.
You can download it from enter link description here
Happy Coding.
I'm getting a confusing error while using RStudio. When I use the command line, in the middle of typing a command (never while executing a command), R throws the following error:
Error in loadNamespace(name) : there is no package called ‘.GlobalEnv’
I am using R version 3.2.3 and RStudio version 0.99.491; I have tried to re-install RStudio and to delete settings.
Look at the tabs that open at startup.
In my case, it was because there was a debugging tab opened and RStudio was trying to load it at startup. I just closed it and that error stopped.