org.rosuda.JRclient
Class RFactor

java.lang.Object
  extended byorg.rosuda.JRclient.RFactor

public class RFactor
extends 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,v 1.1 2005/10/05 20:20:16 eytanadar Exp $

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

Constructor Detail

RFactor

public RFactor()
create a new, empty factor var


RFactor

public RFactor(int[] i,
               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,
               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(String v)
add a new element (by name)

Parameters:
v - value

at

public 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 String toString()
displayable representation of the factor variable