خرید بک لینک

Vote count: 0

My Rcpp code is occasionally failing (SEGFAULT, etc.) for reasons I don't understand. The code creates a large data.frame, and then tries to obtain a subset of this data.frame by calling the R subset function, [.data.frame), from within the same method that is creating the frame. A very simplified version of it is shown below:

 // R function to subset data.frame - what will be called to subset
 Function subsetinR("[.data.frame");

 // Make a dataframe in Rcpp to subset
 auto df =  List::create(  Named("a") = std::vector<double> {1.0, 2.0});
 df["b"] = std::vector<double> {3.0, 4.0});
 df.attr("class") = "data.frame";
 df.attr("row.names") = seq_len(2);
 df.attr("file") = "somestuff";     

 // Now make a vector to subset with 
 LogicalVector filter = LogicalVector::create(2, TRUE);

 // Subset, here is where it fails!
 df = subsetinR(wrap(df), filter, R_MissingArg);

However, while this occasionally works, it will other times it fails with one of the following errors: Error: object of type 'symbol' is not subsettable, or libR.dylib was compiled with optimization - stepping may behave oddly; variables may not be available. or occasionally when ruing tests in RStudio instead of at the command line *** caught segfault *** address 0x100000011, cause 'memory not mapped'.

Anyone know what is going wrong?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 29 تير 1395 ساعت: 8:43

صفحه بندی