loading packages works in Rconsole but fail in bash terminal

The following script runs in R console but when run in bash terminal using the Rscript command it throws the error below the code.

libs = c("openxlsx", "biomaRt", "stringr", "yaml")
invisible(suppressPackageStartupMessages(lapply(libs, require, character.only=TRUE)))

Error

Every effort to install and reinstall the above mentioned packages has rendered no fruit. I keep wondering why the packages load in the console but fail in the terminal command

My R version is 3.6.0 and for dependency issues that is the only one I can use for now.

Try update.packages("dplyr")

1 Like

Thanks , I tried this but it didn't work.
What worked is I wrote a dplyr.r script for installing the 1.0.9 version of dplyr and installed it with Rscript dplyr.r and that solved the problem.

1 Like

The essence remained that if I installed or updated in the r console itself , somehow it never reflected the changes that are picked with the Rscript, however the vice-versa is not true, changes made using the Rscript command are reflected in the r console.

Rscript must be running as sudo ergo installing into the system-level package library and the R console running as a regular user which by default installs into a user-level package library.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.