File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1+ 2014-02-23 Kevin Ushey <kevinushey@gmail.com>
2+
3+ * inst/include/Rcpp/DataFrame.h: better nrows behavior
4+
152014-02-17 Romain Francois <romain@r-enthusiasts.com>
26
37 * inst/include/Rcpp/traits/un_pointer.h: fix bug in un_pointer for object<T>
Original file line number Diff line number Diff line change 1515 as the vector .sort() method. These fixes ensure that sugar functions
1616 depending on IndexHash (unique , sort_unique , match ) will now properly
1717 handle NA and NaN values for numeric vectors.
18+ \item DataFrame :: nrows now more accurately mimics R ' s internal behavior
19+ (checks the row.names attribute)
1820 }
1921 \i tem Changes in Rcpp Attributes
2022 \i temize{
Original file line number Diff line number Diff line change @@ -60,7 +60,12 @@ namespace Rcpp{
6060 }
6161
6262 inline int nrows () const {
63- return Rf_length ( VECTOR_ELT (Parent::get__ (), 0 ) );
63+ SEXP rn = Rf_getAttrib ( Parent::get__ (), R_RowNamesSymbol );
64+ if (TYPEOF (rn) == INTSXP && LENGTH (rn) == 2 && INTEGER (rn)[0 ] == NA_INTEGER)
65+ return INTEGER (rn)[1 ];
66+ if (Rf_isNull (rn))
67+ return 0 ;
68+ return LENGTH (rn);
6469 }
6570
6671 static DataFrame_Impl create (){
You can’t perform that action at this time.
0 commit comments