1 package ubic.basecode.util.r;
2
3 import org.rosuda.REngine.REXP;
4 import org.rosuda.REngine.REXPMismatchException;
5 import org.rosuda.REngine.RList;
6
7 import java.util.List;
8
9
10
11
12
13
14
15 public class HTest {
16
17 private String dataname = "";
18 private String method = "";
19 private double parameter = Double.NaN;
20 private double pvalue = Double.NaN;
21 private double statistic = Double.NaN;
22
23 public HTest() {
24 }
25
26 public HTest( RList rexp ) throws REXPMismatchException {
27 if ( rexp == null || rexp.size() == 0 ) {
28 return;
29 }
30 List<String> names = rexp.names;
31 for ( String n : names ) {
32 REXP o = ( REXP ) rexp.get( n );
33 if ( n.equals( "method" ) ) {
34 this.method = o.asString();
35 } else if ( n.equals( "statistic" ) ) {
36 this.statistic = o.asDouble();
37 } else if ( n.equals( "parameter" ) ) {
38 this.parameter = o.asDouble();
39 } else if ( n.equals( "p.value" ) ) {
40 this.pvalue = o.asDouble();
41 } else if ( n.equals( "conf.inf" ) ) {
42
43 } else if ( n.equals( "data.name" ) ) {
44 this.dataname = o.asString();
45 }
46 }
47 }
48
49 public String getDataname() {
50 return dataname;
51 }
52
53 public String getMethod() {
54 return method;
55 }
56
57 public double getParameter() {
58 return parameter;
59 }
60
61 public double getPvalue() {
62 return pvalue;
63 }
64
65 public double getStatistic() {
66 return statistic;
67 }
68 }