org.rosuda.JRclient
Class RFactor

java.lang.Object
  extended by org.rosuda.JRclient.RFactor

public class RFactor
extends java.lang.Object

representation of a factor variable. In R there is no actual xpression 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

Version:
$Id: RFactor.java 2746 2007-05-10 17:14:14Z urbanek $

Constructor Summary
RFactor()
          create a new, empty factor var
RFactor(int[] i, java.lang.String[] v)
          create a new factor variable, based on the supplied arrays.
RFactor(int[] i, java.util.Vector v)
          special constructor used by REXP parser to save some re-indexing and performing automatic index conversion
 
Method Summary
 void add(java.lang.String v)
          add a new element (by name)
 java.lang.String at(int i)
          returns name for a specific ID
 int size()
          returns the number of caes
 java.lang.String toString()
          displayable representation of the factor variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RFactor

public RFactor()
create a new, empty factor var


RFactor

public RFactor(int[] i,
               java.lang.String[] v)
create a new factor variable, based on the supplied arrays.

Parameters:
i - array if IDs (0..v.length-1)
v - values - cotegory names

RFactor

public RFactor(int[] i,
               java.util.Vector v)
special constructor used by REXP parser to save some re-indexing and performing automatic index conversion

Parameters:
i - index array
v - vector of xpressions which should be all strings
Method Detail

add

public void add(java.lang.String v)
add a new element (by name)

Parameters:
v - value

at

public java.lang.String at(int i)
returns name for a specific ID

Parameters:
i - ID
Returns:
name. may throw exception if out of range

size

public int size()
returns the number of caes


toString

public java.lang.String toString()
displayable representation of the factor variable

Overrides:
toString in class java.lang.Object