Questions tagged [rscript]

Rscript (Rscript.exe on Windows) is a binary front-end to R, for use in scripting applications.

Rscript (Rscript.exe on Windows) is a binary front-end to R, for use in scripting applications. It is included in the core R distribution since version 2.5.0.

littler is an alternative front end to R for use in '#!' scripts.

Example:

Rscript

#! /path/to/Rscript
args <- commandArgs()
args <- args[-(1:match("--args", args)]
cat('hello world!', args, "\n")

littler

#! /path/to/r
cat('hello world!', argv, "\n")

Rscript passes all script arguments to R as additional elements to the vector returned from commandArgs().

littler provides convenience by assigning the script arguments to an argv vector and placing that into the global environment, a convention followed by other popular scripting languages.

656 questions
0
votes
0 answers

Run R with no gui

I am trying to get a default installed CentOS7 R 3.2.3 running without GUI, just for the data processing. The following code runs fine on OSX with no gui output, but fails on CentOS. I start both as Rscript script.r someMatrix.txt theMatrix =…
El Dude
  • 5,328
  • 11
  • 54
  • 101
0
votes
1 answer

Rscript using incorrect R version

Similar to this question which has no working answer. I am attempting to use Rscript on linux redhat 6.6, however Rscript uses the incorrect R version. How can I get Rscript to use the latest R version? Running Rscript --version yields R scripting…
Bas
  • 1,066
  • 1
  • 10
  • 28
0
votes
1 answer

How to pass in function parameters for an R file when run from terminal?

I have a file on my computer that I want to run from the command line. This file would have some stuff happening within it + a function. For example I have a global variable, start_value=10 and then I call a function further down in the Rscript. …
runningbirds
  • 6,235
  • 13
  • 55
  • 94
0
votes
1 answer

Run Rscript.exe with VBScript and spaces in path

I have the followaing run.vbs script Rexe = "R-Portable\App\R-Portable\bin\Rscript.exe" Ropts = "--no-save --no-environ --no-init-file --no-restore --no-Rconsole " RScriptFile = "runShinyApp.R" Outfile =…
0
votes
0 answers

Syntax error near unexpected token when qsubbing

I'm using "qsub" to submit a script to the cluster. My command is this: qsub -cwd -e err -o out ./ps1.R file1 file2 file3 file4 file5 However, the err file keeps…
0
votes
1 answer

Run multiple R scripts with exiting/restarting in between on Linux

I have a series of R scripts for doing the multiple steps of data analysis that I require. Some of these take a very long time and create really large objects. I've noticed that if I just source all of them in a row (via a main.R script),…
Chris Watson
  • 1,347
  • 1
  • 9
  • 24
0
votes
1 answer

create and run a batch file of R scripts from command prompt only if a condition satisfies

I need to do the following: 1) From an R script (lets call it sample1.r), I will get a variable updated and a vector dates. 2) Now what I need to do is, if a condition satisfies (which is if updated == 1), I need to run a batch file of R scripts by…
user3664020
  • 2,980
  • 6
  • 24
  • 45
0
votes
0 answers

Access, Update and Run an R script from another R script

I would like to access, update and run an R script from another R script. Specifically, I would like to create a loop that reads in the lines of another R script in order to update some variable names by adding increments of 1 to each of them. Once…
nrcjea001
  • 1,027
  • 1
  • 9
  • 21
0
votes
0 answers

R script never stop when calling from C# console app

I encounter a strange problem when calling a R script with C#. The Console App works perfectly on our dev and preprod machines, but not in the production server. In production, the R process is blocked after a few minutes, the console never close…
twisted
  • 59
  • 1
  • 9
0
votes
0 answers

How to use options (error=recover) in Rscript

I have an Rscript I would like to run. It takes a very long time to run (took about 23 hours on a 64gb 32 node cluster). It keeps running into an error at this time. My boss told me to run the script locally on my macbook 4gb ram and use…
Evan
  • 1,477
  • 1
  • 17
  • 34
0
votes
1 answer

How to specify encoding while creating file?

I am using an R script to create and append a file. But I need the file to be saved in ANSI encoding,even though some characters are in Unicode format. How to ensure ANSI encoding? newfile='\home\user\abc.ttl' file.create(newfile) text3 <-…
lost Coder
  • 577
  • 2
  • 8
  • 34
0
votes
1 answer

Inovoking R Script from remote machine with SSH is failing

I am using R for doing some process and I am trying to automate this job. R script resides in some other machine. I need to invoke this script form some other machine and I am invoking the script using ssh .. user@myip "Rscript MyRCode.R". It is…
GHK
  • 241
  • 1
  • 8
  • 19
0
votes
1 answer

In travis.ci Rscript seems to be ignoring the .Reviron file

In travis, I am creating a Renviron file with the following line: options(repos = c(CRAN="http://cran.rstudio.com",DRAT="http://sahilseth.github.io/drat") This adds two repositories CRAN (official R repo) and my personal repo. This works perfectly…
Sahil Seth
  • 195
  • 1
  • 8
0
votes
0 answers

How to pass Landsat data(as R script) as input (band.tf) to java

I have seen commands in Landsat8 package of R I can able to run them in R console now I want to pass these commands in R-script from java. I want to pass landsat8 commands like reflcon(),reclassify() to R from java.I don't know how to pass landsat8…
user28536
  • 123
  • 2
  • 9
0
votes
1 answer

Adding additional panel plots to an XY lattice plot

I'm looking to change the colour of a line and add an additional line in an xy plot Distance<-c(1,2,3,4,5,6,7,8,9,10,11,12,13) PAR<-c(1,3,5,9,15,12,11,6,5,4,3,1,0.5) Function1<-function(Distance,param){ …
AW1991
  • 61
  • 5