rscript

How to run an R script file from the command line

China☆狼群 提交于 2020-01-23 12:07:55
问题 I know there are a lot of questions regarding this issue but I've tried everything and I think I just don't understand how the command line works in windows. I have a file saved in a folder on my desktop, let's say: C:\Users\abika_000\Desktop\R models\myfile.R Here is the directory to my R/bin or Rscript/bin: C:\Program Files\R\R-3.1.0\bin I want to run this code using the cmd prompt. How would I go about doing this? I've tried this solution from the question below but I just keep getting

can use package interactively, but Rscript gives errors

ぐ巨炮叔叔 提交于 2020-01-15 06:03:44
问题 I'm using the "topicmodels" package in R. Everything works fine interactively, but if I run the exact same commands using Rscript , I get errors. The first error (which I solved) is that R didn't know what the is() function was. I solved this by importing the "methods" package. Apparently, Rscript doesn't import this automatically, even though interactive R does, and this caused a problem with is(). Problem solved. However, I am now stuck at a different error, which I can't figure out. I am

Rscript does not recognize setGeneric function

烈酒焚心 提交于 2020-01-14 13:46:07
问题 I am trying to convert an R script into something that a client can run in batch mode. My code uses generic functions and one snippet which is near the beginning goes like: setGeneric("testInput", function(inputData, params = list()) standardGeneric("testInput")) I've been using R CMD BATCH and it works fine. However I couldn't find an easy way to make my script print the output on the console, so based on that (and suggestion that Rscript.exe is the "proper" way to run R batch files) I

call R script from Shiny App

筅森魡賤 提交于 2020-01-12 09:46:25
问题 I developed a shiny app which displays some dynamic charts. These charts are generated at execution time according to the value of some buttons. This shiny app gets the data from a raw csv which is previously treated and transformed. I got a Rscript apart from the shiny app to do all those "transformations" of the raw data. What I would like to do is to call this Rscript from the shiny app in order to be executed when the shiny app is launched. I have already checked these links but it didn't

call R script from Shiny App

强颜欢笑 提交于 2020-01-12 09:45:14
问题 I developed a shiny app which displays some dynamic charts. These charts are generated at execution time according to the value of some buttons. This shiny app gets the data from a raw csv which is previously treated and transformed. I got a Rscript apart from the shiny app to do all those "transformations" of the raw data. What I would like to do is to call this Rscript from the shiny app in order to be executed when the shiny app is launched. I have already checked these links but it didn't

user input in R (Rscript and Widows command prompt)

[亡魂溺海] 提交于 2020-01-12 04:00:08
问题 I am trying to figure out, how can i run an r script, using Rscript in windows command prompt and ask for user input. So far, i have found answers on how do ask for user input in R's interactive shell. Any effort in doing the same with readline() or scan() has failed. example: I have a polynomial y=cX where X can take more than one values X1 , X2 , X3 and so on. C variable is know, so what i need in order to calculate the value of y is to ask the user for the Xi values and store them

Rscript and Nodejs integration on Ubuntu Server

一个人想着一个人 提交于 2020-01-06 04:00:05
问题 I am trying to build a node js app in which i call rscript to do some statistical computation and return an array with 8 elements which then i pass back to nodejs so that we can display those elements on ejs pages . I am successfully able to do this on local host everything is working fine and even rscript is running and giving back the output, but when we try to do the same on ubuntu server we are not getiing any console.log(out) on our terminal (out is the variable which gets the output

R, command line, write to file fails

陌路散爱 提交于 2020-01-04 15:31:36
问题 I am trying to automate (on a Win7 system) an R script to read data from Bloomberg and write it to file, for processing by another system. My code runs in the R gui perfectly. So I wrote a batch file to call this .r file and output results to script.out as shown below. When I double click the batch file everything runs successfully. When I schedule a task to run the batch file, the R code runs, collects data from Bloomberg, but the write to file fails every time. R code library(quantmod)

Rscript issue - using different version of R?

我与影子孤独终老i 提交于 2019-12-31 04:03:12
问题 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) 回答1: I figured it out with help from comments

Rscript pointing to incorrect R version in local build

让人想犯罪 __ 提交于 2019-12-31 02:34:26
问题 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