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

How to get rid of this error message 'closure' is not subsettable' in R shiny

I am creating a R shiny app that takes a CSV file as input and has three options: 'Browse' to load the CSV file 'SplitColumn' removes spaces from merged columns, my CSV may have merged columns at times. 'Replace' and 'By' are used to replace…
Kevin Tracey
  • 154
  • 1
  • 16
1
vote
1 answer

How can values of a datatable be replaced in R shiny

I am creating a simple R shiny app where the user uploads a .CSV file and it renders the data table in the main panel, as well as highlights column names automatically in the 'select column' section. What I am looking for is: How can values be…
Kevin Tracey
  • 154
  • 1
  • 16
1
vote
1 answer

How to activate undo button for previous 4 actions in R Shiny

I am creating a R shiny app with buttons like browse, SpitColumn, deleting rows, values, and columns. Everything functions as it should. I have included a "undo" button, but I'm not sure how to make it work in the server function, also how to undo…
Kevin Tracey
  • 154
  • 1
  • 16
1
vote
3 answers

Rscript ggplot - ggsave problem

I am using the following code to draw a graph and print it to a PDF: ggplot(agg_data_cl, aes( as.Date(date), avg_entries, color = classification ) ) + geom_point() ggsave(file = "output.pdf") This works fine when I execute the script in…
behas
  • 3,386
  • 5
  • 27
  • 27
1
vote
1 answer

When I select the dataframe "emp.data B" in R shiny, how do I render a heading/tag as "Summary"?

I'm making R shiny app to generate data frames based on choosing. Only after selecting the data frame emp.data_B I want to present a header text like "Summary." How to do this? Below is my code: library(shiny) emp.data_A <- data.frame( emp_id =…
Kumar
  • 55
  • 5
1
vote
0 answers

After uploading a file using the browse button in R shiny, the file's name is changed

I'm having trouble uploading a file in R shiny. What I'm trying to do is, I use the browse button to select the file (file.csv) from folder A and upload it to folder B, but when I see folder B, the file name appears to be "Bfile.csv" after…
1
vote
0 answers

How can I provide a location in R shiny where the submitted file should be saved?

The code below takes the user's input file (filename1) and uploads it to the same directory with a new name (example: userFile_filename1) in the same directory. I'd want to upload the input file to a separate location. In R shiny, how can I set a…
Kumar
  • 55
  • 5
1
vote
1 answer

How to render the local datasets in R shiny

I have the following R Shiny code that displays CSV results. For the time being, it only works with R's default datasets. I'd want to display the CSV results in the same way for datasets on my local machine. Examples CSVs: Study1.csv, Study2.csv,…
Kumar
  • 55
  • 5
1
vote
0 answers

R script works in RStudio, but not when run via R.exe

What I'm trying to do: I have a long script I wrote in RStudio which links several SQL databases to pull information and ends up putting it all in to a table in one of these databases. I want to make this automated, so I have a computer that is on…
1
vote
1 answer

Is there a way to automatically install all package requirements for an R file?

I have an R file, but it has packages which are not installed on my R installation. Is there a utility which determines these dependencies from the R file and installs all of them? I don't want to manually install them one by one.
piedpiper
  • 1,222
  • 3
  • 14
  • 27
1
vote
0 answers

Change R version of the shell on Mac

my R version on the zsh shell is the 3.6 that is different respect to the one of RStudio that is the 4. In fact, using the Jupyter notebook, the R version is the one used by conda. In fact, to install an r package I must run conda install -c r…
Will
  • 1,619
  • 5
  • 23
1
vote
1 answer

R script, how to group_by and max on factor values?

For a reporting purposes, I've got a data frame which is defined like this: Data: V df_ischemia 12 obs. of 2 variables record_id : 'labelled' chr "1001" "1001" "1001" "1001" "1002" ... ..- attr(*, "label")= chr "Patient number" ischemic:…
BdR
  • 2,770
  • 2
  • 17
  • 36
1
vote
1 answer

How to "source" (not run line by line) an R script from the Windows command line

I am creating an R script myscript.R which manipulates an excel file by means of XLConnectpackage. The point is it refers to several external files: the excel file itself and another R file (functions library), so I need to set a working directory…
abusiro
  • 23
  • 5
1
vote
0 answers

Rscript Path Problem for exec() implementation R code in php

I am trying to run a code of R in PHP, Here are my code : index.php PHP and R Integration Sample
ipipip
  • 11
  • 1
1
vote
0 answers

Rscript won't run in EC2, bash script, due to pandoc and HOME env variable

I am trying to run an Rscript inside an EC2 by supplying a set of scripts to the instance from S3. The EC2 instance is a custom AMI running R and R Server. When the instance is fired up, it fetches it's scripts from S3, and runs them, then closes…
monkey
  • 1,213
  • 2
  • 13
  • 35