MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / DataFrame_Impl

Class DataFrame_Impl

inst/include/Rcpp/DataFrame.h:38–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37 template <template <class> class StoragePolicy>
38 class DataFrame_Impl : public Vector<VECSXP, StoragePolicy> {
39 public:
40 typedef Vector<VECSXP, StoragePolicy> Parent ;
41
42 DataFrame_Impl() : Parent( internal::empty_data_frame() ){}
43 DataFrame_Impl(SEXP x) : Parent(x) {
44 set__(x);
45 }
46 DataFrame_Impl( const DataFrame_Impl& other) : Parent() {
47 set__(other) ;
48 }
49
50 template <typename T>
51 DataFrame_Impl( const T& obj ) ;
52
53 DataFrame_Impl& operator=( DataFrame_Impl& other){
54 if (*this != other) set__(other);
55 return *this;
56 }
57
58 DataFrame_Impl& operator=( SEXP x){
59 set__(x) ;
60 return *this ;
61 }
62
63 // By definition, the number of rows in a data.frame is contained
64 // in its row.names attribute. Since R 3.5.0 this is returned as a
65 // compact sequence from which we can just take the (x)length
66 // But as this makes an allocation an even simpler check on length as
67 // discussed in #1430 is also possible and preferable. We also switch
68 // to returning R_xlen_t which as upcast from int is safe
69 inline R_xlen_t nrow() const {
70 Shield<SEXP> rn{Rf_getAttrib(Parent::get__(), R_RowNamesSymbol)};
71 return Rf_xlength(rn);
72 }
73
74 template <typename T>
75 void push_back( const T& object){
76 Parent::push_back(object);
77 set_type_after_push();
78 }
79
80 template <typename T>
81 void push_back( const T& object, const std::string& name ){
82 Parent::push_back(object, name);
83 set_type_after_push();
84 }
85
86 template <typename T>
87 void push_front( const T& object){
88 Parent::push_front(object);
89 set_type_after_push();
90 }
91
92 template <typename T>
93 void push_front( const T& object, const std::string& name){
94 Parent::push_front(object, name);
95 set_type_after_push();

Callers 2

createMethod · 0.85
from_listMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected