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
1 answer

Rscript stuck on a system call to python

I have a periodic script running at background in my Ubuntu Server. If I execute it in RStudio, everything works as expected. But when I execute via terminal with Rscript, it gets stuck when calling a python script (it isn't always... but many times…
Geiser
  • 1,054
  • 1
  • 12
  • 28
0
votes
1 answer

Is possible to use GUI with littler?

I want to write small script with simple GUI using Rscript or littler. In the example I use gWidget2RGtk2. For example, helloworld.R #!/usr/bin/r library(gWidgets2RGtk2) W <- gwindow("Window", visible=FALSE) L <- glabel("Hello World!",…
fnd
  • 335
  • 2
  • 9
0
votes
0 answers

Rscript not producing jpg output in cluster computing

I have an Rscript called iHS.two.hist.R. I have a .sh script called iHS.2.hist.sh When I run my Rscript in my directory, I get my jpeg output. When I call my Rscript in the .sh script, I do not get my jpeg output. I check the error logs and it's…
Evan
  • 1,477
  • 1
  • 17
  • 34
0
votes
1 answer

How to write a bash script that will run on Windows and Linux

I'm writing a bash script to be executed on both Windows and Linux machines from the terminal. One of the lines calls Rscript, a program for executing .R programs. The issue is that in Linux, the command is simply Rscipt, whereas in Windows, it is…
Eliezer
  • 747
  • 7
  • 7
0
votes
1 answer

Placing Limits on Optim

i'm trying to use an algorithm to minimise the least squares of models. I'd like to be able to confine all the parameters to within sensible ranges however when i run this script for whatever reason it is disregarding my limits. More of a debugging…
AW1991
  • 61
  • 5
0
votes
2 answers

link Rscript to non-existant directory

I am using program which automatically assumes that Rscript is installed in my home directory. Not even it is not, but the directory /home/username/bin does not even exist - so calling /home/username/bin/Rscript results in an error. However typing…
Perlnika
  • 4,796
  • 8
  • 36
  • 47
0
votes
1 answer

Error attaining non linear regression diagnostic plots in R

So i have my code here with a great deal of data points, the 3 variables are all exactly the same length and the regression was highly significant.…
AW1991
  • 61
  • 5
0
votes
1 answer

Non Linear Regression Error (Single Gradient Matrix)

I've seen a few of these previously for very simple functions, however the function i'm trying to fit is basically a mixture of 3 functions A gaussian (which dominates at x=0) An exponential (which takes over post gaussian) and a constant which…
AW1991
  • 61
  • 5
0
votes
1 answer

The R script must not set the working directory -- What does this mean ?

I am running R in batch mode using Rwui to display visual contents. In the last section of this document: http://sysbio.mrc-bsu.cam.ac.uk/Rwui/tutorial/Technical_Report.pdf, it is said that the "The R script must not set the working directory" - I…
shean10000
  • 25
  • 1
  • 1
  • 7
0
votes
0 answers

setup_twitter_oauth, searchTwitter and Rscript

I run the following script using an installation of RStudio on a Linux-Server. require(twitteR) require(plyr) setup_twitter_oauth(consumer_key='xxx', consumer_secret='xxx', access_token='xxx',…
feder80
  • 1,195
  • 3
  • 13
  • 34
0
votes
2 answers

Running Rscript via Python using os.system() or subprocess()

I am facing problems running a Rscript via Python using os.system() or subprocess(). Using os.system() to run commands via python works generally fine for me (e.g. with gdalwarp.exe) but not with Rscript.exe. The only difference I can see are…
EikeMike
  • 280
  • 3
  • 12
0
votes
1 answer

Rscript behaving differently when run from commandline and from PHP exec

Hi I'm running an Rscript with PHP exec and it is behaving strangely.......It launches R but throws an error at the following line:- filein = filein[,c("id","bank","trans_date","description","description_2", …
user2987739
  • 713
  • 2
  • 7
  • 9
0
votes
3 answers

R data: Averaging x values into a new vector only if y values are the same

I'm relatively new to R and am having trouble processing my data into a more workable form. If I had a continuous x and y vector, some with with multiple x values for the same y value how would I go about writing a script which could automatically…
0
votes
1 answer

How to display figures using RScript?

I know RScript is non-interactive, but I would like to display figures without running into the R interactive console first (the same way as in python and java). In other words, I am hoping to be able to run a single build command from command…
IssamLaradji
  • 6,637
  • 8
  • 43
  • 68
0
votes
0 answers

How to control R's default printing of dataframe columns to console

I'm working on an R script that will print out duplicated observations to the console for a data frame snippet that I tease out using only the relevant ID columns I need to pinpoint the observations. I was surprised to find the last two columns…
jxramos
  • 7,356
  • 6
  • 57
  • 105