Skip to content

Commit 486c452

Browse files
committed
Three refinements based on code review
1 parent eb90315 commit 486c452

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

inst/include/Rcpp/DataFrame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace Rcpp{
6868
// the row.names. Hence this workaround.
6969
inline int nrow() const {
7070
#if R_VERSION >= R_Version(4, 6, 0)
71-
SEXP v = R_mapAttrib(Parent::get__(), get_row_count, R_NilValue);
71+
Shield<SEXP> v = R_mapAttrib(Parent::get__(), get_row_count, R_NilValue);
7272
if (v != NULL && TYPEOF(v) == INTSXP) {
7373
return INTEGER(v)[0];
7474
} else {

src/utilities.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919

2020
#define COMPILING_RCPP
2121

22-
#include <vector>
22+
#include <cmath>
2323
#include <string>
24+
#include <vector>
2425
#include <Rcpp/Lighter>
2526

2627
// See WRE Section 6.22.6 'Working with attributes' under R 4.6.0 or later
@@ -35,7 +36,7 @@ SEXP get_attr_names(SEXP tag, SEXP attr, void* data) {
3536
}
3637

3738
// See WRE Section 6.22.6 'Working with attributes' under R 4.6.0 or later
38-
// This function extract the number of rows in a data frame
39+
// This function extracts the number of rows in a data frame
3940
// It is used DataFrame_impl::nrow() in a call to R_mapAttrib()
4041
// [[Rcpp::register]]
4142
SEXP get_row_count(SEXP tag, SEXP attr, void* data) {

0 commit comments

Comments
 (0)