constructing a Data Frame in Rcpp

前端 未结 4 1734
名媛妹妹
名媛妹妹 2020-12-14 23:20

I want to construct a data frame in an Rcpp function, but when I get it, it doesn\'t really look like a data frame. I\'ve tried pushing vectors etc. but it leads to the same

4条回答
  •  不思量自难忘°
    2020-12-14 23:49

    I concur with joran. The output of a C function called from within R is a list of all its arguments, both "in" and "out", so each "column" of the dataframe could be represented in the C function call as an argument. Once the result of the C function call is in R, all that remains to be done is to extract those list elements using list indexing and give them the appropriate names.

提交回复
热议问题