This question already has answers here:
What's the best way to use R scripts on the command line (terminal)?
(11 answers)
Running R from Mac OSX terminal
(6 answers)
Scheduling R Script
(7 answers)
Closed 4 years ago.
I have a set of projects in R studio which I open and run a script within them on a daily basis. I want to automate this procedure to save time, by creating a bash script that will open the projects, run the script within them and then close them. I am to the point that I can open a project by running open project.Rproj but I have not found how to execute a script once I open the project in some automated manner (using a bash command).
Any ideas? Thank you.
Related
This question already has answers here:
How to update all packages for a new R version quickly and easily?
(2 answers)
Painless way to install a new version of R?
(12 answers)
Closed 6 months ago.
When I am changing computers, is there a way to move the R packages from old windows machine to new machine? I know I could manually install all the packages, looking for a more automatic and easier option
I recommend to install packages on your new machine when you really need them.
Your old machine will likely contain packages which you tried once but don't use.
Then why install them on your new machine?
If you need on easy way to install the required packages for a project, then have a look at renv.
This question already has answers here:
Schedule R script using cron
(1 answer)
Scheduling R Script
(7 answers)
Closed 5 years ago.
How do I make a command to auto execute a script in Rstudio? I have a script in Rstudio to handle a database, but I need it to be run at 7:00 AM, automatically.
My operation system is Windows and i can't install the cronR. Exist other mode??
Try package cronR:
"Schedule R scripts/processes with the cron scheduler. This allows R users working on Unix/Linux to automate R processes on specific timepoints from R itself. Mark that if you are looking for a Windows scheduler, you might be interested in the R package taskscheduleR available at https://github.com/bnosac/taskscheduleR.
The package contains also an RStudio add-in."
This question already has answers here:
Running scripts without dot slash (Ubuntu vs Mac) [duplicate]
(2 answers)
Closed 6 years ago.
So typically a program with an argument is invoked in the following way:
./helloworld -test
I've been asked to invoke a C program in command-line simply by typing:
helloworld test
In other words, without the "./". I should be able to launch my program in a Unix command-line just as I would "ls". The tools I currently have (that I am aware of) at my disposal to make this happen are Makefile and argv[], but I can't find any questions or documentation on the internet relevant to this particular problem.
Make sure that the PATH variable contains the ./ directory (or better the full path), to run the program without specifying the directory.
This question already has answers here:
Run R from dropbox
(2 answers)
Closed 7 years ago.
For a collaborative project can you install RStudio (and R itself) on a shared dropbox folder, as well as run the script from that same location?
If yes, is there a special procedure that should be employed in setting that up? I currently have both R and RStudio installed on my PC. Does the collaborator need to have R installed on their computer as well for this to work?
Sounds like there are two separate aspects to your question:
Can you share the R & RStudio application/executables
Can you share the R scripts/project documents
Regarding 1, to share the application/executables, you could follow the portable Rstudio approach from #hrbrmstr. That's going to require you providing the correct versions for your collaborator's OS. If you are just working with one person, you may find it easier to have them simply download and install RStudio on their own computer.
If your project requires installing custom libraries from CRAN, make sure to communicate this to your collaborator, as libraries you've installed won't be installed for them.
Regarding 2, sharing the R scripts and project documents is straight forward. They should be able to open these documents and execute them on their own machine.
It's possibly easier to install RStudio Server on AWS. I did it and the only thing that was a bit of a pain was managing the users (you need to shell in). Once the users are set up you can set up a shared environment and also each user has their own environment.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
R: determine if a script is running in Windows or Linux
How can an R script determine what platform it's running on? I'm using R 2.10.1, sometimes on Windows, sometimes on Linux. I would prefer a built-in function over filesystem taxonomy. I've already searched the index of the base package for anything with "os" or "platform" in the description — no dice there, alas.
Alternatives to R.version()$os are .Platform$OS.type and R.Version()$platform. See ?.Platform for further info. Note that Sys.info() is not implemented on all platforms, but does give the key information on which platform R is running whereas the others give info on the platform under which R was built.
You can use R.Version()$os