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

R - Can I pass a command line argument using Rscript to a query using RMySQL dbConnect?

I am trying to pass a site id argument as an integer from Rscript on the command line to a SQL statement inside dbConnect using RMySQL. However I am getting an error "Error in mysqlQuickSQL(conn, statement, ...) : unused arguments ("3", " AND…
0
votes
0 answers

Extracting result of regression function in R script

In R Script, for instance in usage of; regression=lm(a~b) As known, result of linear model regression can be summarized by summarize(regression) In this sample regression variable is a vector which have sub variables an it can be retrieve…
Suat Atan PhD
  • 1,152
  • 13
  • 27
0
votes
1 answer

Syntax Highlighting in FlowDocumentControl for RScript

We have use the following Regex function to highlight the string and numeric String Regex function public string StringRegEx { get { return @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'"; } } Numeric Regex function public string NumberRegEX { …
Uthistran Selvaraj
  • 1,371
  • 1
  • 12
  • 31
0
votes
1 answer

Edit R-script using Excel VBA

I would like to creat a excel macro by using vba, which can edit R-scripts. Let's call this R script starter.R and its working directory is C:/Documents. The Code I want to change is "run=3000". I want to change it to "run=2000". Firstly I want to…
Ken.T
  • 3
  • 2
0
votes
1 answer

Rscript does not have "is" function

I am trying to run some R scripts from the command line using Rscript. I have tried on both mac and linux and run into the following problem on both. The test script below works perfectly fine if I just type it into R: is The script just prints…
jcrudy
  • 3,921
  • 1
  • 24
  • 31
0
votes
1 answer

R creating timeseries with existing dates from file

I'm trying to create a time series plot using R where obtain the dates from a REST request and then I want to group and count the date occurrences on a one week interval. I followed the examples of ts() in R and tried plots, which worked great. But…
codeBarer
  • 2,238
  • 7
  • 44
  • 75
0
votes
1 answer

RJSONIO in Linux environment errors out with https

Hi I'm using RJSONIO in Windows and when I perform the following it works fine: library(RJSONIO) fromJSON("https://issues.apache.org/jira/rest/api/2/project") It returns a JSON but when I do the same thing in Linux I get the following…
codeBarer
  • 2,238
  • 7
  • 44
  • 75
0
votes
2 answers

Passing header as argument in Rscript (different result from running code in GUI)

I am working on a piece of code that, among other variables, passes the header from a bash-script to R. This may seem silly or stupid, but for my particular needs, it is exactly what I want. So, I have a bash-script: #!/bin/bash Rscript script.R…
KJ_
  • 336
  • 1
  • 3
  • 11
0
votes
1 answer

Do we have a setup task concept in hadoop streaming like we have in MapRed java?

I am writing my mapper and reducer in R script . Here i am trying to read one file in the Rscript Mapper . Is there a way i can configure my streaming map red so that it only read this file single time not for each maptask . I understand for hadoop…
Karn_way
  • 1,005
  • 3
  • 19
  • 42
0
votes
0 answers

Inconsistence results when executing Rscript with php

When running a R function I created with Rscript command in ubuntu terminal (after su to Apache server www-data user) I get perfect results (function code not inserted due to length). However, when running the same function via php exec("Rscript…
Guest3290
  • 167
  • 9
0
votes
1 answer

R script log is not getting as output on oozie tasks log

i am using below Rscript as a mapper on hadoop streaming. i want to see log info\warn etc on console of tasktracker or any other place of log that oozie does however its not coming any reason . My oozie job is successfully completed Script #!…
Karn_way
  • 1,005
  • 3
  • 19
  • 42
0
votes
4 answers

How to plot specific data points in a column in R script

Imagine there are two columns, one for p-value and the other representing slope. I want to find a way to plot only the slope data points that have a significant p-value. Here is my code: print("State the file name (include .csv)") filename <-…
kevin ko
  • 115
  • 9
0
votes
2 answers

RScript and statistics to find min

I need to find the minimum of following: Product Year N1 1988 N2 1986 N1 2008 N1 2008 N2 1999 N2 2007 I want to find which year product first listed using RScript. For example product N1 was first listed…
Rehoboth
  • 43
  • 2
  • 6
0
votes
1 answer

R script exhausting memory - Microsoft HPC Cluster

I have an R script with the following source code: genofile<-read.table("D_G.txt", header=T, sep=',') genofile<-genofile[genofile$"GC_SCORE">0.15,] cat(unique(as.vector(genofile[,2])), file="GF_uniqueIDs.txt", sep='\n') D_G.txt is a huge file,…
Delta
  • 305
  • 3
  • 11
0
votes
1 answer

$ operator is invalid for atomic vectors in HH R

I am trying to generate this graph. Using this package Following is in datafile …
henna
  • 368
  • 3
  • 13