search for: ansp

Displaying 3 results from an estimated 3 matches for "ansp".

Did you mean: ansi
2010 Mar 29
2
.Call and .C arguments
...245)) // C Code void myroundC(double *Amount){ *Amount = Rf_fround(*Amount,2); } #Return value in R [[1]] [1] 1204.24 # C call from R .Call("myroundCall",as.double(1204.245)) // C Code SEXP myroundCall(SEXP a){ double *ap = REAL(a), *ansp; SEXP ans; PROTECT(ans = allocVector(REALSXP, 1)); ansp = REAL(ans); *ansp = Rf_fround(*ap,2); UNPROTECT(1); return(ans); } #Return value in R [1] 1204.24 # expected value 1204.25 Thanks a lot for your help....
2004 Feb 11
1
.Call setAttrib(ans,R_DimSymbol,dim); Crashes.
Hi! I want to return a matrix. The code does the R interfacing. This version does it fine. SEXP ans,dim; PROTECT(ans = NEW_NUMERIC(count*2)); memcpy(NUMERIC_POINTER(ans),result,count*sizeof(double)); memcpy(&(NUMERIC_POINTER(ans)[count]),occur,count*sizeof(double)); /** PROTECT(dim=NEW_INTEGER(2)); INTEGER_POINTER(dim)[0]=2; INTEGER_POINTER(dim)[1]=count;
2012 Oct 03
3
Fastest non-overlapping binning mean function out there?
Hi, I'm looking for a super-duper fast mean/sum binning implementation available in R, and before implementing z = binnedMeans(x y) in native code myself, does any one know of an existing function/package for this? I'm sure it already exists. So, given data (x,y) and B bins bx[1] < bx[2] < ... < bx[B] < bx[B+1], I'd like to calculate the binned means (or sums)