Displaying 1 result from an estimated 1 matches for "pdimx".
Did you mean:
dimx
2012 Jun 19
1
R and C pointers
...ept for, what probably is the answer, that matrices are in fact
vectors with dimensions.
This is a sample code I am using at C level:
????????????????????????
# include <R.h>
# include <Rinternals.h>
# include <R_ext/Rdynload.h>
SEXP foo(SEXP x) {
SEXP dimx;
double *px, *pdimx;
PROTECT(dimx = getAttrib(x, R_DimSymbol));
px = REAL(x);
UNPROTECT(1);
return(dimx);
}
????????????????????????
The question is: how to create pointers to dimx (in order to extract
individual values)?
I tried:
pdimx = REAL(dimx);
This is where R complains that:
REAL() can only...