[Rd] returning vectors of unknown size from C (with .C)

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Sat Apr 26 02:23:44 CEST 2008

Dear All,

In a package, I am using ".C" to call some C functions. In one case,
the number of elements of the return vectors are not known in R before
the C call. (Two of the vectors are integers, the third is vector of
character strings).

Passing from R a vector of the maximum possible size would be a huge
waste. I understand one alternative is to use ".Call", but I'd rather
avoid it if I can (all of the code seems working except for the return
of values into R). Another would be to write to a file from C and then
read that into R, but this looks very ugly. Are there any other
reasonable alternatives, or should I just use .Call?



Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)

More information about the R-devel mailing list