[Rcpp-devel] Segfault problem when adding RcppFrame to RcppResultSet on gcc 4.1.2
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 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 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 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);
___
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] Using Rcpp in MS VC++
Hi - I tried to start using Rcpp in MS VC++. As expected, with my experience I can't get it to work. The compiled Rcpp.dll was compiled with MinGW and the mangled name convention seem to be totally different from MS VC++ convention. I also tried compiling the source within VC++ myself. However, I have to ensure that I expose all necessary functions, classes and members to the dll explicitly. I'm wondering if there's any better way to get it to work in VC++? Any suggestion is highly recommended. Thanks. Rob ___ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] Passing large data frame
Hi,
I have a doubt regarding passing large data frame into Rcpp. If we
consider the following function
foo(SEXP myframe) {
RcppFrame &fr_ref = (RcppFrame &) myframe;
}
Somehow seems to work without a need to call a constructor and thus
causes copy of large data frame to RcppFrame object. However, you can
see that the code is not safe. there's no guarantee that myframe is a
data frame. This is my first question, is there any way to check type
of the input SEXP? Or is there any better way to do this?
Secondly, I'm wondering why the POSIXct column in my data frame
appears as double when I pass a data frame as an argument into a
function or when I read it out from global environment map? Is there
anyway to ensure it appears as RcppDatetime? Thank you.
Robert
___
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
