We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 373a8b4 commit 1a7cf97Copy full SHA for 1a7cf97
inst/include/Rcpp/DataFrame.h
@@ -61,11 +61,19 @@ namespace Rcpp{
61
}
62
63
inline int nrows() const {
64
- SEXP rn = Rf_getAttrib( Parent::get__(), R_RowNamesSymbol );
65
- if (TYPEOF(rn) == INTSXP && LENGTH(rn) == 2 && INTEGER(rn)[0] == NA_INTEGER)
66
- return INTEGER(rn)[1];
+ SEXP rn = R_NilValue ;
+ SEXP att = ATTRIB( Parent::get__() ) ;
+ while( att != R_NilValue ){
67
+ if( TAG(att) == R_RowNamesSymbol ) {
68
+ rn = CAR(att) ;
69
+ break ;
70
+ }
71
+ att = CDR(att) ;
72
73
if (Rf_isNull(rn))
74
return 0;
75
+ if (TYPEOF(rn) == INTSXP && LENGTH(rn) == 2 && INTEGER(rn)[0] == NA_INTEGER)
76
+ return -INTEGER(rn)[1];
77
return LENGTH(rn);
78
79
0 commit comments