We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f075788 commit eaded60Copy full SHA for eaded60
1 file changed
inst/include/Rcpp/DataFrame.h
@@ -20,9 +20,16 @@ namespace Rcpp{
20
~DataFrame_Impl() ;
21
22
int nrows() const {
23
- SEXP rn = Rf_getAttrib( *this, R_RowNamesSymbol ) ;
24
- if( TYPEOF(rn) == INTSXP && LENGTH(rn) == 2 && INTEGER(rn)[0] == NA_INTEGER ) return INTEGER(rn)[1] ;
+ SEXP rn = R_NilValue ;
+ SEXP att = ATTRIB( Storage::get__() );
25
+ while( att != R_NilValue ){
26
+ if( TAG(att) == R_RowNamesSymbol ){
27
+ rn = CAR(att) ;
28
+ }
29
+ att = CDR(att) ;
30
31
if( Rf_isNull(rn) ) return 0 ;
32
+ if( TYPEOF(rn) == INTSXP && LENGTH(rn) == 2 && INTEGER(rn)[0] == NA_INTEGER ) return -INTEGER(rn)[1] ;
33
return LENGTH(rn) ;
34
}
35
0 commit comments