I am trying to run an R script through the command line. My R script contains statement for inclusion of library and some methods of the same library as given here. The command line statement I am using to run the code is as below.
Test.R
library("readxl")
sales <- read_xlsx("<file path>", sheet = 1)
Commands:
cd "C:\Users\Debasish.sena\Desktop\out"
"C:\Program Files\R\R-3.2.2\bin\x64\Rscript.exe" -e "install.packages('readxl', repos = 'https://cran.us.r-project.org')"
"C:\Program Files\R\R-3.2.2\bin\x64\R.exe" CMD BATCH "C:\Users\Debasish.sena\Documents\Test.R" "C:\Users\Debasish.sena\Desktop\out\Test.Rout"
While executing the command I am getting the error as below:
Warning in install.packages("readxl", repos = "https://cran.us.r-project.org") :
'lib = "C:/Program Files/R/R-3.2.2/library"' is not writable
Error in install.packages("readxl", repos = "https://cran.us.r-project.org") :
unable to install packages
Execution halted
I am expecting the R script to be executed and the results stored in 'sales' variable