[R] Adding RcppFrame to RcppResultSet causes segmentation fault
Romain Francois
romain.francois at dbmail.com
Thu Apr 1 18:07:20 CEST 2010
The thread has been handled in Rcpp-devel. Rob posted there 7 minutes
after posting on r-help.
FWIW, I think the problem is fixed on the Rcpp 0.7.11 version (on cran
incoming)
Romain
Le 01/04/10 17:47, Matthew Dowle a écrit :
>
> Rob,
> Please look again at Romain's reply to you on 19th March. He informed you
> then that Rcpp has its own dedicated mailing list and he gave you the link.
> Matthew
>
> "R_help Help"<rhelpacc at gmail.com> wrote in message
> news:ad1ead5f1003291753p68d6ed52q572940f13e1c038d at mail.gmail.com...
>> Hi,
>>
>> I'm a bit puzzled. I uses exactly the same code in RcppExamples
>> package to try adding RcppFrame object to RcppResultSet. When running
>> it gives me segmentation fault problem. I'm using gcc 4.1.2 on redhat
>> 64bit. I'm not sure if this is the cause of the problem. Any advice
>> would be greatly appreciated. Thank you.
>>
>> Rob.
>>
>>
>> int numCol=4;
>> std::vector<std::string> colNames(numCol);
>> colNames[0] = "alpha"; // column of strings
>> colNames[1] = "beta"; // column of reals
>> colNames[2] = "gamma"; // factor column
>> colNames[3] = "delta"; // column of Dates
>> RcppFrame frame(colNames);
>>
>> // Third column will be a factor. In the current implementation the
>> // level names are copied to every factor value (and factors
>> // in the same column must have the same level names). The level names
>> // for a particular column will be factored out (pardon the pun) in
>> // a future release.
>> int numLevels = 2;
>> std::string *levelNames = new std::string[2];
>> levelNames[0] = std::string("pass"); // level 1
>> levelNames[1] = std::string("fail"); // level 2
>>
>> // First row (this one determines column types).
>> std::vector<ColDatum> row1(numCol);
>> row1[0].setStringValue("a");
>> row1[1].setDoubleValue(3.14);
>> row1[2].setFactorValue(levelNames, numLevels, 1);
>> row1[3].setDateValue(RcppDate(7,4,2006));
>> frame.addRow(row1);
>>
>> // Second row.
>> std::vector<ColDatum> row2(numCol);
>> row2[0].setStringValue("b");
>> row2[1].setDoubleValue(6.28);
>> row2[2].setFactorValue(levelNames, numLevels, 1);
>> row2[3].setDateValue(RcppDate(12,25,2006));
>> frame.addRow(row2);
>>
>> RcppResultSet rs;
>> rs.add("PreDF", frame);
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/OIXN : raster images and RImageJ
|- http://tr.im/OcQe : Rcpp 0.7.7
`- http://tr.im/O1wO : highlight 0.1-5
More information about the R-help
mailing list