DM::RConverter Namespace Reference

provides a set of converter function between DM and the open source statistic package R More...

Typedefs

typedef ConstIterator< IPointconst_iterator_point
 Point iterator.
 

Functions

DM_API void initEmbeddedR (int argc=0, char *argv[]=0)
 Initializes the embedded R instance Must be called only once for the overall process. If the DM library is used in connection with rpy, the function MUST NOT be called, since the initialization is done by rpy.
 
DM_API void * asDataFrame (const_iterator_point it, const_iterator_point end, const AddInfoLayoutHandle &layout, bool withCoordinates=true, FilterHandle filter=FilterHandle())
 convert a set points including there attributes into an R data frame object More...
 
DM_API void * asDataFrame (const_iterator_point it, const_iterator_point end, const AddInfoLayoutHandle &layout, const DM::AddInfoLayoutHandle &mapCol, const DM::IIndexMapSet &map, DM::IIndexHelperSet &helper, bool invertIndexMap, bool withCoordinates=true, FilterHandle filter=FilterHandle())
 
DM_API int64_t setFrom (const_iterator_point it, const_iterator_point end, const AddInfoLayoutHandle &layout, void *sexpObj, FilterHandle filter=FilterHandle())
 set point attributes from an R data frame object More...
 
DM_API void * createDataFrame (int64_t rowCount, const AddInfoLayoutHandle &layout, bool withCoordinates=true)
 Creates a empty data frame object of a given size based. More...
 
DM_API int64_t fillDataFrame (void *sexpObj, int64_t rowIdx, const_iterator_point it, const_iterator_point end, FilterHandle filter=FilterHandle())
 fill an existing data frame object with a set of points at the specified row index More...
 
DM_API int64_t fillDataFrame (void *sexpObj, int64_t rowIdx, const AddInfoLayoutHandle &mapColumn, const IIndexMapSet &map, IIndexHelperSet &helper, bool invertIndexMap, const_iterator_point it, const_iterator_point end, FilterHandle filter=FilterHandle())
 fill an existing data frame object with a subset of points at the specified row index More...
 
DM_API void compareWith (void *sexpObj, DM::IClassificationMatrix &classMatrix, const_iterator_point it, const_iterator_point end, const DM::AddInfoLayoutHandle &mapCol, const DM::IIndexMapSet &map, DM::IIndexHelperSet &helper, bool invertIndexMap, DM::FilterHandle filter=FilterHandle())
 

Detailed Description

provides a set of converter function between DM and the open source statistic package R

Function Documentation

◆ asDataFrame()

DM_API void* DM::RConverter::asDataFrame ( const_iterator_point  it,
const_iterator_point  end,
const AddInfoLayoutHandle layout,
bool  withCoordinates = true,
FilterHandle  filter = FilterHandle() 
)

convert a set points including there attributes into an R data frame object

A data frame object can be seen as database table supporting labeled columns of different data types. Since R cannot handle column name starting with an underscore '_', user-defined attributes are prefixed with an 'X'.

Parameters
[in]itbegin iterator of points
[in]endend iterator of points
[in]layoutdefines the attributes that should be transferred
[in]withCoordinatesflag if the coordinates should be copied as well
[in]filteroptional filter to subselect the points
Returns
pointer to the SEXP data frame object
Examples
DM_r_convert.cpp.

◆ createDataFrame()

DM_API void* DM::RConverter::createDataFrame ( int64_t  rowCount,
const AddInfoLayoutHandle layout,
bool  withCoordinates = true 
)

Creates a empty data frame object of a given size based.

Parameters
[in]rowCountnumber of rows to reserve
[in]layoutdefines the attributes (columns of the data frame object) to that should be generated
[in]withCoordinatesflag if columns for the coordinates should generated as well
Returns
pointer to the SEXP data frame object
Examples
DM_r_convert.cpp.

◆ fillDataFrame() [1/2]

DM_API int64_t DM::RConverter::fillDataFrame ( void *  sexpObj,
int64_t  rowIdx,
const AddInfoLayoutHandle mapColumn,
const IIndexMapSet map,
IIndexHelperSet helper,
bool  invertIndexMap,
const_iterator_point  it,
const_iterator_point  end,
FilterHandle  filter = FilterHandle() 
)

fill an existing data frame object with a subset of points at the specified row index

Compared to the standard fillDataFrame function, this implementation allows converting a subset of the points into the dataframe object. The subset is defined by the IndexMapSet object, containing each point index that should be inserted to the dataframe. Moreover the selection is not restricted to a single index but to multiple indices which are selected based on an integer attribute as defined in the layout mapColumn. The index based selection can be inverted by the invertIndexMap flag. Currently only data frame objects that are created by the createDataFrame function can be filled

Parameters
[in]sexpObjdata frame object to be filled
[in]rowIdxat which row index the data should be filled
[in]mapColumnattribute (single column layout) for accessing the relevant map index
[in]mapindex map object describing the object indices for selection
[in]helperindex helper object for keeping track of traversed map index (can be empty. the object is extended automatically)
[in]invertIndexMapif false all objects listed by the index map are inserted to the dataframe. Otherwise all objects that are NOT listed are inserted.
[in]itstart iterator
[in]endend iterator
[in]filteroptional filter to subselect the points
Returns
number rows that have been filled

◆ fillDataFrame() [2/2]

DM_API int64_t DM::RConverter::fillDataFrame ( void *  sexpObj,
int64_t  rowIdx,
const_iterator_point  it,
const_iterator_point  end,
FilterHandle  filter = FilterHandle() 
)

fill an existing data frame object with a set of points at the specified row index

Currently only data frame objects that are created by the createDataFrame function can be filled

Parameters
[in]sexpObjdata frame object to be filled
[in]rowIdxat which row index the data should be filled
[in]itstart iterator
[in]endend iterator
[in]filteroptional filter to subselect the points
Returns
number rows that have been filled
Examples
DM_r_convert.cpp.

◆ setFrom()

DM_API int64_t DM::RConverter::setFrom ( const_iterator_point  it,
const_iterator_point  end,
const AddInfoLayoutHandle layout,
void *  sexpObj,
FilterHandle  filter = FilterHandle() 
)

set point attributes from an R data frame object

The attribute number of the layout and the column of the R object have to match. However, it is not necessary that the number of points, implicitly given by the iterator object, and the number of rows of the R data frame object matches. The number of changed points will be returned

Parameters
[in]itbegin iterator of points
[in]endend iterator of points
[in]layoutattributes set from the the data frame object
[in]sexpObjSEXP object containing all the attribute values (to avoid header file dependencies a simple raw pointer is used)
[in]filteroptional filter to subselect the points
Returns
Number of points changed