rscript

Rscript on ubuntu

北城以北 提交于 2019-12-03 09:05:06
Where can I install Rscript from? I need to run an R script from a php file using exec. However I need to install Rscript first. Search the ubuntu repositories . Have you checked the littler package? The main package for R is called r-base . For the scripting and command-line front-end see littler (or r-cran-littler in xenial (16.04LTS) and beyond): sudo apt-get install littler The answers posted so far are generally useful, but they don't directly answer the question. I recently had the same question and discovered there is no rscript binary for Ubuntu. The r binary itself is used to execute

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

坚强是说给别人听的谎言 提交于 2019-12-02 20:11:54
问题 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 spaces in the path. Avoiding problems with spaces in the path are easy overcome in the CMD-window by putting the paths in quotation marks. Executing the following command is successfull. "C:/Program Files/R/R-3.0.2/bin/Rscript.exe" "D:/.../otsu_Script.R"

How do I tell summary to not wrap columns?

夙愿已清 提交于 2019-12-02 13:44:53
问题 I am trying to get summary to not wrap its output. However, when I call summary with 5 columns of data, it places the 5th column on a separate row. I am hoping there is a way that's easier than manually printing iterating over the object returned by summary. Best Regards, Joseph plotit.r #!/usr/bin/Rscript noneData <- read.csv("query.log", header=FALSE, sep="\t"); cnames = c( 'vids', 'partitions', 'localvert', 'remotevert', 'cachehits', 'responsetime' ); colnames(noneData) <- cnames;

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

梦想与她 提交于 2019-12-02 07:29:57
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 spaces in the path. Avoiding problems with spaces in the path are easy overcome in the CMD-window by putting the paths in quotation marks. Executing the following command is successfull. "C:/Program Files/R/R-3.0.2/bin/Rscript.exe" "D:/.../otsu_Script.R" But I am stuck with Python. What I tried so far with python: os.system("C:/Program Files/R/R-3.0.2/bin

How do I tell summary to not wrap columns?

若如初见. 提交于 2019-12-02 07:24:38
I am trying to get summary to not wrap its output. However, when I call summary with 5 columns of data, it places the 5th column on a separate row. I am hoping there is a way that's easier than manually printing iterating over the object returned by summary. Best Regards, Joseph plotit.r #!/usr/bin/Rscript noneData <- read.csv("query.log", header=FALSE, sep="\t"); cnames = c( 'vids', 'partitions', 'localvert', 'remotevert', 'cachehits', 'responsetime' ); colnames(noneData) <- cnames; cachenames = c('1', '2', '3', '4', '5'); responseCompare = data.frame( noneData$responsetime/1000000, noneData

Rscript issue - using different version of R?

大憨熊 提交于 2019-12-02 04:24:33
I'm trying to load a library in an Rscript, but it's giving me a strange error. I'm running the 2.12.1 version of the Rscript binary, yet it complains that my package was built under version 2.12.1. Any idea what's going on here? [17:55:13 trash] $ ./tmp.R Loading required package: blah Error: (converted from warning) package 'blah' was built under R version 2.12.1 [17:55:47 trash] $ cat tmp.R #!/path/to/R/2.12.1/bin/Rscript --quiet library(blah) I figured it out with help from comments by @aL3xa and @Iterator. When I run whereis Rscript , I get: Rscript: /usr/bin/Rscript /usr/bin/X11/Rscript

Rscript pointing to incorrect R version in local build

我是研究僧i 提交于 2019-12-01 20:39:42
I recently installed a local version of R 3.1.0 on a Linux Redhat server as follows: # from R-3.1.0 directory ./configure --prefix=$(pwd) make make install In addition, I've updated PATH and R_LIBS in my .bashrc. If I run path/to/local/R/bin/Rscript --version , then it returns the proper version number. However, if I give it a test script that prints sessionInfo it yields information from the system-wide R installation. Is there any more I need to do to run the local version of R using Rscript? From reading a similar issue here , it looks like the code above should be all that's necessary.

Capturing Rscript errors in an output file

强颜欢笑 提交于 2019-11-28 22:11:59
问题 Unlike the similar command R CMD BATCH which by default produces an output file which contains any error messages which would cause the execution of a script to halt, I have not been able to find a way to do this with Rscript . I have tried using a pipe in my linux shell to achieve this: RScript --no-save --no-restore --verbose myRfile.R > outputFile.Rout but this will only pipe over any output that occurred before an error occurs, so the file outputFile.R doesn't contain any error

Rscript could not find function

人走茶凉 提交于 2019-11-27 23:37:05
I need to run several scripts via the bash shell using Rscript and some functions I use require the function isGeneric . However, in this case the process end like that (for example): Error in .getLogLik() : could not find function "isGeneric" Calls: main -> dredge -> .getLik -> .getLogLik Execution halted This can be reproduced as follows # in the bash shell echo "isGeneric('apply')" > /tmp/test.R Rscript /tmp/test.R Result: Error: could not find function "isGeneric" Execution halted However, if we open a R session and type the following, it works: # in the R shell isGeneric('apply') [1]

Why (or when) is Rscript (or littler) better than R CMD BATCH?

旧时模样 提交于 2019-11-27 07:57:54
I am automating some webscraping with R in cron and sometimes I use R CMD BATCH and sometimes I use Rscript . To decide which one to use I mainly focus if I want the .Rout file or not. But reading the answers to some questions here in SO (like this or this ) it seems that Rscript is preferred to R CMD BATCH . So my questions are: Besides the fact that the syntax is a little different and R CMD BATCH saves an .Rout file while Rscript does not, what are the main differences between the two of them? When should I prefer one over another? More specifically, in the cron job above mentioned, is one