12 #ifndef ROOT_R_TRDataFrame 13 #define ROOT_R_TRDataFrame 15 #ifndef ROOT_R_RExports 19 #ifndef ROOT_R_TRObject 23 #ifndef ROOT_R_TRFunctionImport 185 friend SEXP Rcpp::wrap<TRDataFrame>(
const TRDataFrame &
f);
210 int size =
fDf.size(), i = 0 ;
211 Rcpp::CharacterVector names =
fDf.attr(
"names");
226 Rcpp::CharacterVector nnames(size + 1);
227 for (i = 0; i < size; i++) {
229 nnames[i] = names[i];
233 nDf.attr(
"class") =
fDf.attr(
"class") ;
234 nDf.attr(
"row.names") =
fDf.attr(
"row.names") ;
235 nDf.attr(
"names") = nnames ;
247 int size =
fDf.size(), i = 0 ;
248 Rcpp::CharacterVector names =
fDf.attr(
"names");
260 Rcpp::CharacterVector nnames(size + 1);
261 for (i = 0; i < size; i++) {
262 nDf[i] = obj.
fDf[i] ;
263 nnames[i] = names[i];
268 nDf.attr(
"class") = obj.
fDf.attr(
"class") ;
269 nDf.attr(
"row.names") = obj.
fDf.attr(
"row.names") ;
270 nDf.attr(
"names") = nnames ;
300 int size =
fDf.size(), i = 0 ;
301 Rcpp::CharacterVector names =
fDf.attr(
"names");
313 Rcpp::CharacterVector nnames(size + 1);
314 for (i = 0; i < size; i++) {
316 nnames[i] = names[i];
321 nDf.attr(
"class") =
fDf.attr(
"class") ;
322 nDf.attr(
"row.names") =
fDf.attr(
"row.names") ;
323 nDf.attr(
"names") = nnames ;
328 template <
class T>
operator T()
332 template <
class T>
operator T()
const 352 df = Rcpp::as<Rcpp::DataFrame>(obj);
383 df = Rcpp::as<Rcpp::DataFrame>(obj);
392 operator SEXP()
const 419 Rcpp::CharacterVector names = df.attr(
"names");
421 for (
int i = 0; i <
GetNcols(); i++)rnames[i] = names[i];
433 return Rcpp::as<TMatrixT<T> >(asMatrix(df));
443 if (label ==
"") print(df);
444 else print(df[label.Data()]);
TVectorString GetColNames()
Method to get labels of dataframe.
Namespace for new ROOT classes and functions.
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
void Print(TString label="")
Method to print the dataframe in stdout or a column given the label.
Binding operator[](const TString &name)
TMatrixT< T > AsMatrix()
Method to get dataframe as matrix.
Binding(Rcpp::DataFrame &_df, TString name)
Construct a Binding nestead class for facilities with operators.
TRDataFrame(SEXP obj)
TDataFrame constructor.
TRDataFrame & operator=(TRDataFrame obj)
#define ClassDef(name, id)
Binding operator=(T var)
template method for operator assignation
Binding(const Binding &obj)
Copy constructor for Binding nestead class.
This is a class to pass functions from ROOT to R.
TRDataFrame & operator=(SEXP obj)
int GetNcols()
Method to get the number of colunms.
std::vector< TString > TVectorString
Binding & operator>>(T &var)
Template method for operator >> that lets to use dataframes like streams example: df["v"]>>vector;...
Mother of all ROOT objects.
int GetNrows()
Method to get the number of rows.
Rcpp::internal::NamedPlaceHolder Label
TRDataFrame(const Rcpp::DataFrame &_df)
TDataFrame constructor for Rcpp::DataFrame.
TRDataFrame & operator=(TRDataFrame &obj)
This is a class to create DataFrames from ROOT to R
const char * Data() const