Skip to content

Commit fb89148

Browse files
avoid a callback to R in empty_data_frame. closes #47
1 parent e379776 commit fb89148

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

inst/include/Rcpp/DataFrame.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ namespace Rcpp{
2626

2727
namespace internal{
2828
inline SEXP empty_data_frame(){
29-
SEXP dataFrameSym = ::Rf_install( "data.frame");
30-
return ::Rf_eval( ::Rf_lang1( dataFrameSym ), R_GlobalEnv ) ;
29+
Shield<SEXP> df = Rf_allocVector(VECSXP, 0);
30+
Rf_setAttrib(df, R_NamesSymbol, Rf_allocVector(STRSXP, 0));
31+
Rf_setAttrib(df, R_RowNamesSymbol, Rf_allocVector(INTSXP, 0));
32+
Rf_setAttrib(df, R_ClassSymbol, Rf_mkString("data.frame"));
33+
return df;
3134
}
3235
}
3336

0 commit comments

Comments
 (0)