[Rcpp-devel] Yet another instance of "function 'dataptr' not provided ..."
romain at r-enthusiasts.com
Tue Mar 25 20:24:26 CET 2014
You need to import something, anything from Rcpp’s namespace. Sent you a pull request.
Le 25 mars 2014 à 20:17, Douglas Bates <bates at stat.wisc.edu> a écrit :
> I must have been away from writing R/Rcpp code for too long.
> I started off trying to reproduce a calculation that is, literally, a one-liner in Julia. See
> Now admittedly the calculation of the sums of the n choose k possible subsets of size k from a vector or length n is aided by the fact that there is a combinations iterator in Julia. Nonetheless it is pretty amazing that this can be written as
> combsums(v::Vector, k) = [sum(c) for c in combinations(v,k)]
> using this iterator and a comprehension.
> I tried to write the combinations iterator in C++ but eventually tied myself in knots so I decided to back off and write a function that does the equivalent of the R function sample() and use that to generate a random sample from the distribution of sums.
> I have the C++ code working using Rcpp attributes but now I must generate a package. I have to be missing something obvious because my attempt at
> produces the dread "function 'dataptr' not provided ..." message when I try to invoke the R function randomsums.
> Which of the many vignettes or manuals should I start reading?
> (I can't believe I have spent two days going through innumerable contortions to try to achieve the effect of a one-liner.)
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rcpp-devel