I am using R from a distant linux server. I want to make an R script file, open an scripts files and edit them. However, I can just use the R command line. I have no idea how I can create an R script file like in RGui, or how to open such files for editing.
Asked
Active
Viewed 8,627 times
0
-
Why do you want to edit a script with R? Use an text editor such as vi. – Feb 06 '15 at 10:19
-
1No, it is bunch of R functions, needed to be ran several ties. It must be in ***.R file. – Amir_Control Feb 06 '15 at 10:21
-
If you have access to R, you have access to the terminal. Create a file (using your local text editor, like nano, or vim and pass that to Rscript or run it manually through R. – Roman Luštrik Feb 06 '15 at 10:22
-
Alternatively create your script on your local computer and send it to the server. That's what I did before we installed RStudio Server. It's often more convenient than working in a terminal. – Roland Feb 06 '15 at 10:27
1 Answers
0
There are multiple non graphical editors to edit your file that you have access to in command line, like nano
or vim
.
To create an Rscript file, simply add #!/usr/bin/env Rscript
at the top of your .R
file and make it executable.
Also see Run R script from command line