Hi,

 

I'm new to 'R' and need some help on the "Load" command. Any responses
will be highly appreciated. Thanks in advance!

 

As per manuals, the "Load" command expects a binary file input that is
saved using a "save" command. However it is required that we need to
call the 'R' program from 

Java web application using RJava, and pass a string to the 'R" program
instead of a binary file. Is it possible?

 

I was exploring the options of using TextConnections, file connections
and other types of connections in order to read a stream of input
(either from a file, stdin etc). I am able to read the string, but the
Save and Load commands are not accepting the string input. Here is the
sequence of commands I tried running, and the error received. There is
no clue on this error, especially when trying to use the eval function
in randomForest package, even on the internet. Can anyone help please!

 

 

 

> library(randomForest)

randomForest 4.5-34

Type rfNews() to see new features/changes/bug fixes.

 

> load("C://Program Files//R//R-2.10.1//bin//rfoutput")

 

> zz <- file("ex.data", "w")

 

> cat("\"imurder\" \"itheft\" \"irobbery\" \"iassault\" \"idrug\"
\"iburglary\" \"igun\" \"psych\" \"Freq\" \"priors\" \"firstage\"
\"intage\" \"sex\" \"race\" \"marstat\" \"empac\" 

\"educ\" \"zipcode\" \"suspendmn\" \"drugs\" \"alco\" \"probation\"
\"parole\"",file = zz, sep = "\n", fill = TRUE)

 

> cat("\"10\" 0 0 0 1 0 0 0 0 0 58 19 19 \"1\" \"BLACK\" \"SINGLE\"
\"UNEMPLD\" 0 21215 0 0 0 1 0",file = zz, sep = "\n", fill = TRUE)

 

> save(zz, file = "testmurali", version = 2)

 

> predict(rfoutput,newdata="testmurali",type="response")

Error in eval(expr, envir, enclos) : object 'imurder' not found

 

>  

 

Best Regards,

Murali Godavarthi

mgodavar...@dpscs.state.md.us

 

 

 

 

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to