org.rosuda.REngine
Class REXPDouble

java.lang.Object
  extended by org.rosuda.REngine.REXP
      extended by org.rosuda.REngine.REXPVector
          extended by org.rosuda.REngine.REXPDouble

public class REXPDouble
extends REXPVector

REXPDouble represents a vector of double precision floating point values.


Field Summary
static double NA
          NA real value as defined in R.
 
Fields inherited from class org.rosuda.REngine.REXP
attr, maxDebugItems
 
Constructor Summary
REXPDouble(double load)
          create real vector of the length 1 with the given value as its first (and only) element
REXPDouble(double[] load)
           
REXPDouble(double[] load, REXPList attr)
           
 
Method Summary
 double[] asDoubles()
          returns the values represented by this vector
 int[] asIntegers()
          converts the values of this vector into integers by cast
 java.lang.Object asNativeJavaObject()
          attempt to represent the REXP by a native Java object and return it.
 java.lang.String[] asStrings()
          converts the values of this vector into strings
 boolean[] isNA()
          returns a boolean vector of the same length as this vector with true for NA values and false for any other values (including NaNs)
static boolean isNA(double value)
          checks whether a given double value is a NA representation in R.
 boolean isNumeric()
          return true
 int length()
          returns the length of the vector (i.e. the number of elements)
 java.lang.String toDebugString()
          returns representation that it useful for debugging (e.g. it includes attributes and may include vector values -- see REXP.maxDebugItems)
 
Methods inherited from class org.rosuda.REngine.REXPVector
isVector, toString
 
Methods inherited from class org.rosuda.REngine.REXP
_attr, asBytes, asDouble, asDoubleMatrix, asFactor, asInteger, asList, asString, createDataFrame, createDoubleMatrix, dim, getAttribute, hasAttribute, inherits, isComplex, isEnvironment, isExpression, isFactor, isInteger, isLanguage, isList, isLogical, isNull, isPairList, isRaw, isRecursive, isReference, isString, isSymbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NA

public static final double NA
NA real value as defined in R. Note: it can NOT be used in comparisons, you must use isNA(double) instead.

Constructor Detail

REXPDouble

public REXPDouble(double load)
create real vector of the length 1 with the given value as its first (and only) element


REXPDouble

public REXPDouble(double[] load)

REXPDouble

public REXPDouble(double[] load,
                  REXPList attr)
Method Detail

isNA

public static boolean isNA(double value)
checks whether a given double value is a NA representation in R. Note that NA is NaN but not all NaNs are NA.


length

public int length()
Description copied from class: REXPVector
returns the length of the vector (i.e. the number of elements)

Specified by:
length in class REXPVector
Returns:
length of the vector

asNativeJavaObject

public java.lang.Object asNativeJavaObject()
Description copied from class: REXP
attempt to represent the REXP by a native Java object and return it. Note that this may lead to loss of information (e.g., factors may be returned as a string array) and attributes are ignored. Not all R types can be converted to native Java objects. Also note that R has no concept of scalars, so vectors of length 1 will always be returned as an arrays (i.e., int[1] and not Integer).

Overrides:
asNativeJavaObject in class REXP

isNumeric

public boolean isNumeric()
return true

Overrides:
isNumeric in class REXP
Returns:
true if the receiver is a numeric vector, false otherwise

asDoubles

public double[] asDoubles()
returns the values represented by this vector

Overrides:
asDoubles in class REXP

asIntegers

public int[] asIntegers()
converts the values of this vector into integers by cast

Overrides:
asIntegers in class REXP

asStrings

public java.lang.String[] asStrings()
converts the values of this vector into strings

Overrides:
asStrings in class REXP

isNA

public boolean[] isNA()
returns a boolean vector of the same length as this vector with true for NA values and false for any other values (including NaNs)

Overrides:
isNA in class REXPVector
Returns:
a boolean vector of the same length as this vector with true for NA values and false for any other values

toDebugString

public java.lang.String toDebugString()
Description copied from class: REXP
returns representation that it useful for debugging (e.g. it includes attributes and may include vector values -- see REXP.maxDebugItems)

Overrides:
toDebugString in class REXPVector
Returns:
extended description of the obejct -- it may include vector values