12 #ifndef ROOT_R_TRDataFrame 13 #define ROOT_R_TRDataFrame 179 friend SEXP Rcpp::wrap<TRDataFrame>(
const TRDataFrame &
f);
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]) {
TVectorString GetColNames()
Method to get labels of dataframe.
Namespace for new ROOT classes and functions.
void Print(const Char_t *label="")
Method to print the dataframe in stdout or a column given the label.
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 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.
Int_t GetNcols()
Method to get the number of colunms.
This is a class to pass functions from ROOT to R.
TRDataFrame & operator=(SEXP obj)
Int_t GetNrows()
Method to get the number of rows.
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.
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