I am trying to automate running a R script from a WSL environment. I receive the same error:
Error in library(ggplot2) :
there is no package called ‘ggplot2’
Execution halted
I have tried solutions from Rscript: There is no package called ...? without any result.
I have tried iterations of the test script below.
Rscript test.r
signal <- .libPaths(c("C://Program Files//R//R-3.5.3//library",
"C://Users//USER//Documents//R//win-library//3.5"))
library("ggplot2", lib.loc = signal)
print("Hello World")
____________________________________________
Rscript test.r
signal <- .libPaths()
library("ggplot2", lib.loc = signal)
print("Hello World")
______________________________________________
Rscript test.r -e ".libPaths(c("C://Program Files//R//R-3.5.3//library",
"C://Users//USER//Documents//R//win-library//3.5"))"
library(ggplot2)
print("Hello World")
I believe the error is caused by path set for my libraries. I am wondering if WSL environment is causing an issue with paths featuring the "/mnt/" prefix. I have tried changing the paths to accommodate this without any solution.