[Rcpp-devel] Yet another instance of "function 'dataptr' not provided ..."
Romain François
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
>
> http://nbviewer.ipython.org/gist/dmbates/9746197
>
> 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
>
> http://github.com/dmbates/randomizationTest
>
> 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
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140325/745bdb73/attachment.html>
More information about the Rcpp-devel
mailing list