|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.REngine.RFactor
public class RFactor
representation of a factor variable. In R there is no actual object type called "factor", instead it is coded as an int vector with a list attribute. The parser code of REXP converts such constructs directly into the RFactor objects and defines an own XT_FACTOR type
Constructor Summary | |
---|---|
RFactor()
create a new, empty factor var |
|
RFactor(int[] i,
java.lang.String[] v)
same as RFactor(i,v, true, 1) |
|
RFactor(int[] i,
java.lang.String[] v,
boolean copy,
int index_base)
create a new factor variable, based on the supplied arrays. |
|
RFactor(java.lang.String[] c)
same as RFactor(c, 1) |
|
RFactor(java.lang.String[] c,
int index_base)
create a new factor variable by factorizing a given string array. |
Method Summary | |
---|---|
int[] |
asIntegers()
return the contents as integer indices (with the index base of this factor) |
int[] |
asIntegers(int desired_index_base)
return the contents as integer indices with a given index base |
java.lang.String[] |
asStrings()
return the factor as an array of strings |
java.lang.String |
at(int i)
returns the level of a given case |
boolean |
contains(int li)
returns true if the data contain the given level index |
boolean |
contains(java.lang.String name)
return true if the factor contains the given level (it is NOT the same as levelIndex==-1!) |
int |
count(int levelIndex)
count the number of occurences of a given level index |
int |
count(java.lang.String name)
count the number of occurences of a given level name |
int[] |
counts()
return an array with level counts. |
int |
indexAt(int i)
return the level index for a given case |
int |
indexBase()
return the base of the levels index |
java.lang.String |
levelAtIndex(int li)
return the level name for a given level index |
int |
levelIndex(java.lang.String name)
return the index of a given level name or -1 if it doesn't exist |
java.lang.String[] |
levels()
return the list of levels (0-based, use indexBase() correction if you want to access it by level index) |
int |
size()
returns the number of cases |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RFactor()
public RFactor(int[] i, java.lang.String[] v, boolean copy, int index_base)
i
- array of IDs (inde_base..v.length+index_base-1)v
- values - cotegory namescopy
- copy above vaules or just retain themindex_base
- index of the first level element (1 for R factors, cannot be negtive)public RFactor(java.lang.String[] c, int index_base)
c
- contentsindex_base
- base of the level indexpublic RFactor(java.lang.String[] c)
RFactor(c, 1)
public RFactor(int[] i, java.lang.String[] v)
RFactor(i,v, true, 1)
Method Detail |
---|
public java.lang.String at(int i)
i
- case number
public boolean contains(int li)
true
if the data contain the given level index
public boolean contains(java.lang.String name)
true
if the factor contains the given level (it is NOT the same as levelIndex==-1!)
public int count(int levelIndex)
public int count(java.lang.String name)
public int[] counts()
public int levelIndex(java.lang.String name)
public java.lang.String[] levels()
indexBase()
correction if you want to access it by level index)
public int[] asIntegers()
public int[] asIntegers(int desired_index_base)
public java.lang.String levelAtIndex(int li)
public int indexAt(int i)
public java.lang.String[] asStrings()
public int indexBase()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |