|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.j2r.types.REXPAbstract
org.nuiton.j2r.types.RDataFrame
public class RDataFrame
Java implementation of the R data.frame
| Field Summary |
|---|
| Fields inherited from class org.nuiton.j2r.types.REXPAbstract |
|---|
attributes, dataInconsistencyText, engine, indexExceptionText, names, noVariable, variable |
| Constructor Summary | |
|---|---|
RDataFrame(REngine engine)
Constructor |
|
RDataFrame(REngine engine,
java.util.List<java.lang.String> names,
java.util.List<java.lang.String> rowNames,
java.util.List<java.util.List<? extends java.lang.Object>> data,
java.lang.String variable)
Constructor |
|
RDataFrame(REngine engine,
java.lang.Object[] datatypes,
int y)
Constructor |
|
RDataFrame(REngine engine,
java.lang.String[] names,
java.lang.String[] rowNames,
java.util.List<java.util.List<? extends java.lang.Object>> data,
java.lang.String variable)
Constructor, used for autoconversion from rexp to data.frame. |
|
| Method Summary | |
|---|---|
void |
checkX(int x)
Check if the index is into the data.frame length throws a IndexOutOfBoundsException if not the index is too big. |
void |
exportCsv(java.io.File outputFile,
boolean rowNames,
boolean names)
Export the data.frame into csv format. |
java.lang.Object |
get(int x,
int y)
Method to get the object located at the [x,y] coordinates. |
java.util.List<java.util.List<? extends java.lang.Object>> |
getData()
Method to get the ArrayLists of the R data.frame (there is no synchronizing with R). |
void |
getFrom(java.lang.String variable)
Method to get a data.frame from a variable in R. |
java.lang.String |
getRowName(int y)
Method to get the row name of the row index y+1 of the R data.frame. |
java.util.List<java.lang.String> |
getRowNames()
Method to get the names of the rows of the R data.frame |
void |
importCsv(java.io.File inputFile,
boolean rowNames,
boolean names)
Import a dataframe form a csv file. |
void |
importCsv(java.io.File inputFile,
boolean rowNames,
boolean names,
java.util.List<java.lang.Object> importTypes)
Import a dataframe from a csv file. |
void |
importCsv(java.io.File inputFile,
boolean rowNames,
boolean names,
java.lang.Object importType)
Import a dataframe form a csv file. |
void |
set(int x,
int y,
java.lang.Object data)
Method to set the value (x,y) to a Double value. |
void |
setData(java.util.List<java.util.List<? extends java.lang.Object>> data)
Method to assign the data of the R data.frame (there is no synchronizing with R, use the commit() method to send data to R. |
void |
setRowName(int x,
java.lang.String rowName)
Method to assign the name of the ArrayList at the index x. |
void |
setRowNames(java.util.List<java.lang.String> rowNames)
Method to assign the names of the rows of the R data.frame |
java.lang.String |
toRString()
Method to export the data.frame in a String for evaluation in R. |
| Methods inherited from class org.nuiton.j2r.types.REXPAbstract |
|---|
checkVariable, getAttribute, getAttributes, getEngine, getName, getNames, getVariable, setAttribute, setAttributes, setEngine, setName, setNames, setVariable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.nuiton.j2r.types.REXP |
|---|
getAttribute, getAttributes, getVariable, setAttribute, setAttributes |
| Constructor Detail |
|---|
public RDataFrame(REngine engine)
engine - the engine in which the data frame will be located.
public RDataFrame(REngine engine,
java.lang.Object[] datatypes,
int y)
throws RException
engine - the engine in which the data frame will be located.datatypes - a table object determining the type of each column of
the data.frame.y - the length of each vector that compound the data.frame.
RException
public RDataFrame(REngine engine,
java.util.List<java.lang.String> names,
java.util.List<java.lang.String> rowNames,
java.util.List<java.util.List<? extends java.lang.Object>> data,
java.lang.String variable)
throws RException
engine - the engine in which the data frame will be located.names - names of the the data.frame columns.rowNames - names of the data.frame rows.data - the data of the data.framevariable - the name of the data.frame in R.
RException - if an error occur while trying to
initialize
public RDataFrame(REngine engine,
java.lang.String[] names,
java.lang.String[] rowNames,
java.util.List<java.util.List<? extends java.lang.Object>> data,
java.lang.String variable)
engine - the engine in which the data frame will be located.names - names of the the data.frame columns.rowNames - names of the data.frame rows.data - the data of the data.framevariable - the name of the data.frame in R.| Method Detail |
|---|
public java.util.List<java.lang.String> getRowNames()
throws RException
RException - if an error occurs while getting back the names from R.
java.lang.IndexOutOfBoundsException - when the row.names size get from R is bigger than the local
data size.
public java.lang.String getRowName(int y)
throws RException
y - index of the row (0 to n-1)
RException - if an error occurs while getting back the row name from R.
public void setRowNames(java.util.List<java.lang.String> rowNames)
throws RException
rowNames - a ArrayList containing the names of the rows of the R
data.frame
RException - if an error occur while in R.
java.lang.IndexOutOfBoundsException - when the row names ArrayList is longer than the data.frame
length
public void setRowName(int x,
java.lang.String rowName)
throws RException
x - index of the ArrayList (0 to n-1)name - Name of the ArrayList.
RException - if an error occur while in R.
java.lang.IndexOutOfBoundsException - when the index is out of the data.frame bounds.
public java.lang.String toRString()
throws RException
toRString in interface REXPRException - If no variable name is given
public void set(int x,
int y,
java.lang.Object data)
throws RException
x - x coordinate (from 0 to size-1)y - y coordinate (from 0 to size-1)data - value to set
RException - if no variable name has been given to the data.frame or the
data type is not allowed at this location.
public java.lang.Object get(int x,
int y)
throws RException
x - x coordinates (between 0 and size-1)y - y coordinates (between 0 and size-1)
RException - if no variable name has been given to the data.frame
java.lang.IndexOutOfBoundsException - if the x or y coordinates are not correct.public java.util.List<java.util.List<? extends java.lang.Object>> getData()
public void setData(java.util.List<java.util.List<? extends java.lang.Object>> data)
throws RException
data - a ArrayList of ArrayLists, containing each ArrayList of the R
data.frameengine - a REngine where the R session is located.
RException
public void getFrom(java.lang.String variable)
throws RException
getFrom in interface REXPvariable - name of the data.frame in Rengine - a REngine where the R session is located.
RException
public void exportCsv(java.io.File outputFile,
boolean rowNames,
boolean names)
throws java.io.IOException
outputFile - the file to writerowNames - true/false to determine if the row names will be put on
the export.names - true/false to determine if the column names will be put on
the export.
java.io.IOException
public void importCsv(java.io.File inputFile,
boolean rowNames,
boolean names)
throws java.io.FileNotFoundException,
java.io.IOException
inputFile - Csv file to import.rowNames - Does the csv file contains names of the rows.names - Does the csv file contain names of the columns.
java.io.FileNotFoundException
java.io.IOException
public void importCsv(java.io.File inputFile,
boolean rowNames,
boolean names,
java.lang.Object importType)
throws java.io.FileNotFoundException,
java.io.IOException
inputFile - Csv file to import.rowNames - Does the csv file contains names of the rows.names - Does the csv file contain names of the columns.importType - Object of the class of the data imported (all the data have
the same type). (Supported types : String, Double and Integer)
java.io.FileNotFoundException
java.io.IOException
public void importCsv(java.io.File inputFile,
boolean rowNames,
boolean names,
java.util.List<java.lang.Object> importTypes)
throws java.io.FileNotFoundException,
java.io.IOException
inputFile - Csv file to import.rowNames - Does the csv file contains names of the rows.names - Does the csv file contain names of the columns.importTypes - ArrayList of Object of the class of the data imported (the
ArrayList match the data type of the columns). (Supported
types : String, Double and Integer)
java.io.FileNotFoundException
java.io.IOExceptionpublic void checkX(int x)
checkX in interface REXPx - index
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||