[Rcpp-devel] Segfault problem when adding RcppFrame to RcppResultSet on gcc 4.1.2

Romain Francois romain at r-enthusiasts.com
Tue Mar 30 08:19:23 CEST 2010


Hello,

Which version of Rcpp is this ? I think this has been fixed in 0.7.11

Romain

Le 30/03/10 03:00, R_help Help a écrit :
>
> 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 Rcpp-devel mailing list