Reputation: 1267
I'm a beginner with R. I want to launch R scripts at specific moments, managing this with Linux's cron
and launching the scripts as Rscript name_of_the_script
.
I have installed tidyverse
in Rstudio, with install.packages("tidyverse")
. Ok, but I guess that installation is specific to the Rstudio environment. When working in a script (not using Rstudio), and launching that script with Rscript, the library tidyverse
is not installed. Even worse, I couldn't install it in the script with install.packages("tidyverse")
.
What do you suggest? Thanks.
Upvotes: 0
Views: 2683
Reputation: 1096
The solution is you simply use require()
to load your package without worrying about the path.
require(dplyr)
Upvotes: 2
Reputation: 1345
The library is, in fact, probably installed. It is difficult to be sure of what is the problem without more details, but I would guess that you did not load your library in your script. Try to add the following at the beginning on the first line of your script
library(tidyverse)
Upvotes: 2