rscript

how to connect to Rserve with an R client

梦想的初衷 提交于 2019-12-18 13:36:55
问题 I'm not sure if I am doing this right. In tab 1, I open R, then I execute Rserve(port = 6311) inside the R session. I load the variable "name = Hello World" In tab 2, I open R, then I try to connect to Rserve. I do this by: c = RSconnect(host = "localhost", port 6311) I then try to print hello world by: RSeval(c, name) But it does not work. I get: Error in RSeval(c, name) : object 'name' not found What am I doing wrong here? 回答1: I got some information from the author of Rserve. The variable

Rscript could not find function

可紊 提交于 2019-12-17 16:34:00
问题 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

R package not working properly when using PHP exec() function

空扰寡人 提交于 2019-12-13 18:27:59
问题 UPDATE: SOLVED I've discovered the issue. Using the .libPaths() function, I was able to determine that the default directory that the HH package installed into was not included in the library paths when running Rscript through PHP, even though it was appearing when R was executing the same code through the command prompt. I've resolved the issue by include a separate call to .libPaths('new/file/path'); in my dynamically created syntax. When I do this, test <-require('HH'); test; returns TRUE;

Rscript does not work when invoked in PHP but does from Command Prompt

亡梦爱人 提交于 2019-12-13 17:45:53
问题 I am trying to execute an R script from my PHP page using the exec function. I have set the environment variables in Windows and Rscript works fine on the command prompt. However on the PHP page it says, " 'Rscript' is not recognized as an internal or external command, operable program or batch file." Any help would be greatly appreciated. 回答1: I would define a launcher.bat where I deal will all R-paths problem: PATH PATH_TO_R/R-version/bin;%path% cd PATH_TO_R_SCRIPT Rscript myscript.R arg1

Rscript ggplot - ggsave problem

大兔子大兔子 提交于 2019-12-13 00:54:36
问题 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 TextMate. But when I call it from the commandline via RScript I get the following error: Error in all.vars(as.formula(.$facets)) : could not find function "as.formula" Calls: print ... <Anonymous> -> <Anonymous> -> <Anonymous> -> all.vars Execution halted I

External graphical device for littler or Rscript

邮差的信 提交于 2019-12-12 11:07:25
问题 I really like littler is really great for scripting using R. But i don't how to use external graphics device a la gnuplot (for example using Octave). I'm able to produce the desired graph but i have to use Sys.sleep and i don't want to do so, because i want to close it my self in an interactive way or better continue the script without closing the device. So far this is what my code looks like : #!/usr/bin/env r -t suppressMessages(require(Cairo)) CairoX11() plot(rnorm(1000), pch = 19) Sys

How do I zip a csv file and write that zipped file to a folder using R

假装没事ソ 提交于 2019-12-12 03:15:14
问题 I have an R script which generates a csv file of nearly 80000 KB after calculations. I want to write this csv file to folder say D:/My_Work/Output with file name result.zip as a zipped file. Please suggest is there any function or any way that i could achieve this. 回答1: Use the zip function: zip(*path to zip*,*path to csv*) edit: Unfortunately you cannot go from data.frame straight to zipped csv. You need to explicitly make the csv, but it wouldn't be hard to write a wrapper that deletes the

Rscript using incorrect R version

感情迁移 提交于 2019-12-12 02:59:23
问题 Similar to this question which has no working answer. I am attempting to use Rscript on linux redhat 6.6, however Rscript uses the incorrect R version. How can I get Rscript to use the latest R version? Running Rscript --version yields R scripting front-end version 2.13.0 (2011-04-13) Whereas running R yields: R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) Whereis on both R and

How to let Rscript behave similar to other linux programs by not generating errors upon SIGPIPE?

可紊 提交于 2019-12-11 13:14:01
问题 Here are some related discussions. But I don't think the answers are relevant to my question. Piping Rscript gives error after output Normal linux commands work just fine upon receiving SIGPIPE $ seq 10 |head -n 1 1 But Rscript behaves differently as shown in the above discussion URL. But littler's r does not have this problem. Is there a way to make Rscript use the default SIGPIPE handler so that it will have a similar behavior to other linux programs? Here mentions how to set it a the C

Run Rscript from Spring MVC with Wildfly 9

旧时模样 提交于 2019-12-11 12:57:12
问题 I am trying to run Rscript from JAVA code. I am able to do so. Now I am trying to run same JAVA code from a Spring MVC project and using Wildfly 9 to run the project. For the first time when I am trying to execute JAVA code (to run Rscript) is working fine and giving correct result, but on running 2nd time it is giving error and Wildfly stops running. Below is the error that I am getting: A fatal error has been detected by the Java Runtime Environment: Internal Error (0xc0000029), pid=6768,