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
1
vote
2 answers

R: How to preform "quota sampling" on a dataset in R

I am wondering would anyone have any sample code in order to be able to carry out "Quota Sampling" in R? Thanks in advance! Update with example dataset: For example I will need the following 5 Abnormal, Occurring on a Wednesday, with Humidity…
Jay1995
  • 137
  • 1
  • 14
1
vote
2 answers

Output not showing in Shiny

I complied the below code to show the output as a GGmap in R Script. The code runs fine but the output is not shown. Could anyone please be kind enough to assist. I been trying to figure out the error but still yet not been able to. Appreciate it if…
1
vote
0 answers

R CMD BATCH with crontab

I execute R CMD BATCH using crontab(in centos7). like this... 45 5 * * 5 R CMD BATCH /home/script/my_test.R But i cant't find my_test.Rout file. Where is my_test.Rout file?
ykoo
  • 209
  • 2
  • 9
1
vote
1 answer

Getting the Total counts in each sample of a huge single cell dataframe

I have a huge metadata file with 79 Columns and 78687 Rows. This metadata is from our cancer experiment results. I am using dplyr to query the cell counts for each sample in that metadata. I have 16 samples: , I need to find the cell counts for each…
David
  • 99
  • 1
  • 1
  • 9
1
vote
1 answer

How to build a model for temperature-outcome using dlm?

I have a dataset containing information about weather, air pollution and healthoutcomes. I want to regress temperature (T) and temperature lag (T1) against cardiac deaths (CVD). I have previously used the glm model in R using the following…
hasan arshad
  • 41
  • 2
  • 6
1
vote
0 answers

R method error is.vector(x) || is.factor(x)

i use a R version: 3.6.3 on R version 3.6.2 it's work The message error: Error in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm): is.atomic(x) is not TRUE the method: p <- data_df %>% dplyr::summarise(p =…
pedroooo
  • 563
  • 1
  • 4
  • 17
1
vote
0 answers

Running Rscript with UTF-8 on Windows 10

Instead of opening Rstudio or similar to run my R scripts I have gotten into the habit of running scripts with Rscript.exe from the command line. Works great except when the file I feed Rscript.exe has non-ASCII characters. If my Rscript…
s_baldur
  • 29,441
  • 4
  • 36
  • 69
1
vote
1 answer

Run script on Task Scheduler windows where an excel file is created

I need help with that problem. Searching on Google, I've found a way to run the R script without error. It's creating a .bat file with the directorys of Rscript.exe and the script I want to run: My script is very simple: create a dataframe and save…
Franky1010
  • 11
  • 2
1
vote
1 answer

Running R script from PHP in VSCode not recognizing R packages

I am attempting to run a R script from PHP. I have created a shelled out version of my code that produces the same error message. I am running in VSCode, PHP Version 7.3.9, and R-3.6.2. Below are shelled our versions of my code that demonstrate my…
Garrett
  • 107
  • 10
1
vote
1 answer

How can I run a script on multiple folders

I developed a script to do operations and graphics on temperature and precipitation files and forecasts. I have 3 stations on which I will have to do the same steps, here is a part of the script that changes the name of the station in the text file…
Majdolin
  • 13
  • 3
1
vote
1 answer

Combining variable concatenation and for loops in bash

I have this function in R, which I use to produce a list of dates: #! usr/bin/env Rscript date_seq = function(){ args = commandArgs(trailingOnly = TRUE) library(lubridate) days = seq(ymd(args[1]),ymd(args[2]),1) days…
KVemuri
  • 194
  • 1
  • 16
1
vote
0 answers

Error: No method asJSON S3 class: histogram

I am trying to call R program from Node which will call hist function. I am using npm package r-script - https://www.npmjs.com/package/r-script below is my R code x <- c(1,2,3,4,5,6,6) hist(x, col="lightblue") and here is index.js var express =…
Prasad Gavande
  • 213
  • 1
  • 4
  • 19
1
vote
2 answers

excelTable from excelR package R programming is not showing out put

excelTable() from ExcelR package is showing no output in the Viewer Pane. I have updated all the dependent packages. what could be the problem? data = data.frame(Model = c('Mazda', 'Pegeout', 'Honda Fit', 'Honda CRV'), …
Timsy Suri
  • 458
  • 3
  • 9
1
vote
1 answer

How to source functions but not vectors in R script

I have an R script with several functions I made for multiple projects I have going on. There are also about 40 vectors of characters in this same script. The vectors contain key words I am looking for in different Twitter posts, and the function…
Jacob
  • 406
  • 3
  • 19
1
vote
1 answer

PHP pass array to Rscript

I have a problem about how to pass php array to Rscript. In my project, I need to use php to call Rscript to run R code. But I want to pass php array as parameters in Rscript.But When I do this. php report error:Array to string conversion!. I don't…
shebentao
  • 87
  • 11