| 146 | } |
| 147 | |
| 148 | static DataFrame_Impl from_list( Parent obj ){ |
| 149 | bool use_default_strings_as_factors = true ; |
| 150 | bool strings_as_factors = true ; |
| 151 | int strings_as_factors_index = -1 ; |
| 152 | R_xlen_t n = obj.size() ; |
| 153 | CharacterVector names = obj.attr( "names" ) ; |
| 154 | if( !names.isNULL() ){ |
| 155 | for( int i=0; i<n; i++){ |
| 156 | if( names[i] == "stringsAsFactors" ){ |
| 157 | strings_as_factors_index = i ; |
| 158 | use_default_strings_as_factors = false ; |
| 159 | if( !as<bool>(obj[i]) ) strings_as_factors = false ; |
| 160 | break ; |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | if( use_default_strings_as_factors ) |
| 165 | return DataFrame_Impl(obj) ; |
| 166 | SEXP as_df_symb = Rf_install("as.data.frame"); |
| 167 | SEXP strings_as_factors_symb = Rf_install("stringsAsFactors"); |
| 168 | |
| 169 | obj.erase(strings_as_factors_index) ; |
| 170 | names.erase(strings_as_factors_index) ; |
| 171 | obj.attr( "names") = names ; |
| 172 | Shield<SEXP> call( Rf_lang3(as_df_symb, obj, Rf_ScalarLogical(strings_as_factors) ) ) ; |
| 173 | SET_TAG( CDDR(call), strings_as_factors_symb ) ; |
| 174 | Shield<SEXP> res(Rcpp_fast_eval(call, R_GlobalEnv)); |
| 175 | DataFrame_Impl out( res ) ; |
| 176 | return out ; |
| 177 | |
| 178 | } |
| 179 | |
| 180 | } ; |
| 181 |
nothing calls this directly
no test coverage detected