[Rd] rJava is not working in Solaris through java

2012-12-21 Thread Praveen Kumar
Hi,

we have installed R in solaris 10 sparc machine. After installing R we have
installed rJava package and we did a sample test using R prompt it worked
well. We have written sample Java class to calculate GLM and LM functions.
When we execute the sample java class it returns null for both the
functions. But both the functions are working fine in R console.

sample java class code.



import org.rosuda.JRI.REXP;
import org.rosuda.JRI.RVector;
import org.rosuda.JRI.Rengine;


public class rtest {
static Rengine re;
 
public static void main(String []a)
{
try
{
re = new Rengine(a, false, null);
REXP x11 = re.eval("a<-sample(1:1000,300)");
REXP x12 =  re.eval("b<-sample(1:1000,300)");
REXP x13 =  re.eval("d<-sample(1:1000,300)");
REXP x14 =  re.eval("f<-runif(1:300)");
re.eval("value<-glm(f~a+b+d,family=binomial)");
REXP x1 = re.eval("value");
REXP x2 = re.eval("coef(value)");
System.out.println(x1);
System.out.println(x2);
REXP x111 = re.eval("aa<-c(5,1,3,4,2)");
REXP x112 =  re.eval("bb<-c(7,8,6,9,4)");
REXP x113 =  re.eval("dd<-c(1,0,1,0,1)");
REXP x114 =  re.eval("lm(dd~aa+bb)");
System.out.println(x111);
System.out.println(x112);
System.out.println(x113);
System.out.println(x114);
}
catch(Exception e)
{
e.printStackTrace();
re.end();
//s.end();
}
finally
{
re.end();
//s.end();
   
}
}

}


Thanks in advance.

by,
Praveen Kumar 



--
View this message in context: 
http://r.789695.n4.nabble.com/rJava-is-not-working-in-Solaris-through-java-tp4653701.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Why can't I "unclass" an array?

2012-12-21 Thread Terry Therneau
In a real example I was trying to remove the class from the result of table, just because 
it was to be used as a building block for other things and a simple integer vector seemed 
likely to be most efficient.

  I'm puzzled as to why unclass doesn't work.

> zed <- table(1:5)
> class(zed)
[1] "table"
> class(unclass(zed))
[1] "array"
> class(unclass(unclass(unclass(zed
[1] "array"

> class(as.vector(zed))
[1] "integer"
> sessionInfo()
R Under development (unstable) (2012-11-28 r61176)
Platform: i686-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=C
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Why can't I "unclass" an array?

2012-12-21 Thread Martin Maechler
> Terry Therneau 
> on Fri, 21 Dec 2012 08:05:21 -0600 writes:

> In a real example I was trying to remove the class from the result of 
table, just because 
> it was to be used as a building block for other things and a simple 
integer vector seemed 
> likely to be most efficient.

> I'm puzzled as to why unclass doesn't work.

well  "doesn't work" in this case is really rather an implicit question 
and the topic really has nothing to do with R-devel, I'm sorry
Terry.

--> follow up on R-help  where this belongs.

Martin

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel