search for: calculatenewvaluesomehow

Displaying 1 result from an estimated 1 matches for "calculatenewvaluesomehow".

2005 Aug 08
1
modifying argument of a .C call (DUP=FALSE)
...annot do this in R. I thought of writing some C code to do this and calling it using .C with DUP=FALSE. All I need is a simple for loop that replaces elements with their new value, something like void transform(double *a, int *lengtha) { int i; for (i=0; i < *lengtha; i++) { *(a+i) = calculatenewvaluesomehow(*(a+i)) } } trans <- function(a) .C("transform",as.double(a), as.integer(length(a)) is it possible to do this? The manuals say that it is dangerous, is it possible to avoid the dangers somehow? Tamas