Is it possible to specify command line parameters to R-script in RStudio?
r, rstudio
Solution
I know this question is old and the link below is old, but it answers the question. No, it's not possible (or wasn't as of Jan 29, 2012) to access command line arguments from RStudio.
Link https://support.rstudio.com/hc/communities/public/questions/200659066-Accessing-command-line-options-in-RStudio?locale=en-us
Problem
I want to use RStudio to edit an R-script having command line parameters, e.g., ``` my_rscript --dataset mydataset ``` and then to read the optiion value into an R variable, say, `dataset`, e.g., using `optparse` library. However, I could not find where acommand line can be provided in RStudio, so that I could use "Source on save" feature. Instead, I have to hardcode all program parameters in the program itself: ``` dataset <- "mydataset" ``` which requires modifying the script text each time I need to specify different data. Does anybody know how to provide a command line information?