12#ifndef ROOT_R_TRDataFrame
13#define ROOT_R_TRDataFrame
205 Rcpp::CharacterVector names =
fDf.attr(
"names");
219 Rcpp::List nDf(size + 1);
220 Rcpp::CharacterVector nnames(size + 1);
221 for (i = 0; i < size; i++) {
223 nnames[i] = names[i];
227 nDf.attr(
"class") =
fDf.attr(
"class") ;
228 nDf.attr(
"row.names") =
fDf.attr(
"row.names") ;
229 nDf.attr(
"names") = nnames ;
242 Rcpp::CharacterVector names =
fDf.attr(
"names");
253 Rcpp::List nDf(size + 1);
254 Rcpp::CharacterVector nnames(size + 1);
255 for (i = 0; i < size; i++) {
256 nDf[i] = obj.
fDf[i] ;
257 nnames[i] = names[i];
262 nDf.attr(
"class") = obj.
fDf.attr(
"class") ;
263 nDf.attr(
"row.names") = obj.
fDf.attr(
"row.names") ;
264 nDf.attr(
"names") = nnames ;
295 Rcpp::CharacterVector names =
fDf.attr(
"names");
306 Rcpp::List nDf(size + 1);
307 Rcpp::CharacterVector nnames(size + 1);
308 for (i = 0; i < size; i++) {
310 nnames[i] = names[i];
315 nDf.attr(
"class") =
fDf.attr(
"class") ;
316 nDf.attr(
"row.names") =
fDf.attr(
"row.names") ;
317 nDf.attr(
"names") = nnames ;
322 template <
class T>
operator T()
326 template <
class T>
operator T()
const
346 df = Rcpp::as<Rcpp::DataFrame>(obj);
377 df = Rcpp::as<Rcpp::DataFrame>(obj);
386 operator SEXP()
const
407 Rcpp::CharacterVector names =
df.attr(
"names");
421 return Rcpp::as<TMatrixT<T> >(asMatrix(
df));
431 if (label && !label[0]) {
std::vector< TString > TVectorString
#define R(a, b, c, d, e, f, g, h, i)
#define ClassDef(name, id)
Binding operator=(T var)
template method for operator assignation
Binding & operator>>(T &var)
Template method for operator >> that lets to use dataframes like streams example: df["v"]>>vector;.
Binding operator=(Binding obj)
method for operator assignation of Binding class
Binding(Rcpp::DataFrame &_df, TString name)
Construct a Binding nestead class for facilities with operators.
Binding & operator<<(T var)
Template method for operator << that lets to use dataframes like streams example: df["v"]<<vector;.
Binding(const Binding &obj)
Copy constructor for Binding nestead class.
This is a class to create DataFrames from ROOT to R.
Binding operator[](const TString &name)
Int_t GetNcols()
Method to get the number of colunms.
TMatrixT< T > AsMatrix()
Method to get dataframe as matrix.
void Print(const Char_t *label="")
Method to print the dataframe in stdout or a column given the label.
TRDataFrame(SEXP obj)
TDataFrame constructor.
TRDataFrame()
Default TDataFrame constructor.
TRDataFrame & operator=(TRDataFrame obj)
Int_t GetNrows()
Method to get the number of rows.
TVectorString GetColNames()
Method to get labels of dataframe.
TRDataFrame & operator=(SEXP obj)
TRDataFrame(const Rcpp::DataFrame &_df)
TDataFrame constructor for Rcpp::DataFrame.
TRDataFrame & operator=(TRDataFrame &obj)
This is a class to pass functions from ROOT to R.
ROOT R was implemented using the R Project library and the modules Rcpp and RInside
Mother of all ROOT objects.
const char * Data() const
Rcpp::internal::NamedPlaceHolder Label
Namespace for new ROOT classes and functions.