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

Passing parameters to an r script using windows scheduler

I've written an R script that is scheduled to run each day at a certain time - I had everything working in the windows task scheduler without an issue using: Program/Script: "C:\Program Files\R\R-3.3.3\bin\i386\Rscript.exe" Add arguments:…
0
votes
0 answers

Shell script: Pass objects from inside Rscript to the shell script

I have a shell script file which has an Rscript file in it and some other hadoop commands. For eg: some R script(get_Data) like…
0
votes
4 answers

Linux server: How do I use nohup make sure job is working?

What I know and what I've tried: I have a script in R (called GAM.R) that I want to run in the background that outputs .rdata, .pdf, and .jpg files. Running this from the command line is relatively simple: $ Rscript GAM.R However, this code takes…
Emms
  • 33
  • 5
0
votes
0 answers

Finding average of column of data in R

I am working with data about assassination attempts. I have to find the average baseline Polity score of countries whose leaders survive versus those who do not. The data set looks…
harkintr
  • 11
  • 4
0
votes
1 answer

Portable Makefiles that call Rscript

I'm writing an R package that generates Makefiles, I need to write a Makefile that calls Rscript before making the targets. A MWE of the problem is below. Make quits in error because the right-hand side of .INIT does not execute. Writing a recipe…
landau
  • 5,636
  • 1
  • 22
  • 50
0
votes
0 answers

Can we create wordcloud by executing Rscript from the terminal

I'm developing an application where I need to create Wordcloud of twitter data and also some plots. I tried from RStudio. Now I need to develop a client server application which require all the Rscript to be executed from backend. Is there any way…
Asha N
  • 11
  • 6
0
votes
1 answer

Running SparkR from RStudio returns "Cannot run program Rscript"

I am trying out SparkR with RStudio, but it doesn't seem to work. I have tried the suggested solutions on other questions, but I still can't figure out why it isn't running. The code I am running is as follows if (nchar(Sys.getenv("SPARK_HOME")) <…
liam21c
  • 3
  • 4
0
votes
1 answer

User Based Recommendation in R

I am trying to do user based recommendation in R by using recommenderlab package but all the time I am getting 0(no) prediction out of the model. my code is : library("recommenderlab") # Loading to pre-computed affinity data …
anindya
  • 13
  • 3
0
votes
1 answer

invoke Rscript without a script name

I would like to call Rscript without a proper script, just by writing it in a console. is it possible? something like c:/path/to/R/bin/Rscript.exe "here is a R code, not a R file" I am on Windows.
RockScience
  • 17,932
  • 26
  • 89
  • 125
0
votes
0 answers

r - selecting dataframe columns works differently in Rscript and Rstudio

I have a very curious question. I developed a script (say script1) through Rstudio, than sourced it in another script (say script2). This second script is launched via Rscript. Inside script1 there's this…
ercaran
  • 23
  • 1
  • 1
  • 8
0
votes
1 answer

Error in 1:nrow(newdata) : argument of length 0 while using SVM predict

I'm trying to predict A values based upon model trained by svm. This is how my train and test data looks like: A B C D r00 r01 r02 r03 ... ... ... ... Code Snippet is given below: featvecs = ["B"] for (f in 1:nrow(featvecs))…
user2991421
  • 387
  • 2
  • 4
  • 14
0
votes
0 answers

Unable to run R script from Java

I am trying to call a R script from a Java program in Ecplise (Mars Release (4.5.0), jdk1.8.0_45) using Process pid = Runtime.getRuntime().exec("C:\\Program Files\\R\\R-3.3.1\\bin\\Rscript C:\\path\\HSConcordance.R"); R script file…
Rana
  • 505
  • 1
  • 5
  • 19
0
votes
0 answers

No any plot with networkD3 in R

I tried to run this simple rscript on both RStudio and R x64 but nothing appeared as a result. No plot, nothing... Could someone help please? # Load package library(networkD3) # Create fake data src <- c("A", "A", "A", "A", "B", "B", "C", "C",…
0
votes
2 answers

Equivalent of Mathematica's Which

Mathematica's Which function is a generalized If: Which[test_1, value_1, test_2, value_2, …] evaluates each of the test_i in turn, returning the value of the value_i corresponding to the first one that yields True. It's nothing more than a handy…
kjo
  • 33,683
  • 52
  • 148
  • 265
0
votes
0 answers

package 'mlr' could not be loaded in azure machine learning

I am trying to use the unbalanced package in R in an azure machine learning classification experiment. The problem I'm running into is getting the package to be imported in R, specifically getting the mlr package dependency to be installed too. I…