Displaying 2 results from an estimated 2 matches for "rf_ncol".
Did you mean:
rf_ncols
2014 Mar 31
1
C API to get numrow of data frame
...t;- nrow(x)
print(n)
0
Example :
My C function which deals with data frame looks like and I don't to send
the number of rows of data frame .I want to detect it from the function
itself, my function take data frame as argument and do some on it. I want
API equivalent to nrow. I tried Rf_nrows,Rf_ncols . No much help.
SEXP writeRR(SEXP dataframe) {
}
Any help is very appreciated.
Thanks,
Sandip
[[alternative HTML version deleted]]
2009 Mar 27
0
imporving performance of slicing on matrices and S4 their derivatives
...index="integer"), body=body,
includes="#include <string.h>")
## get A COPY of the @.Data slot from an object derived from
numeric/matrix
body = "/* test performance of getting A COPY of @.Data, keeping
dimnames */
int nrow = Rf_nrows(m);
int ncol = Rf_ncols(m);
SEXP res, dim;
PROTECT(res = allocVector(REALSXP, nrow*ncol));
PROTECT(dim = allocVector(INTSXP, 2));
INTEGER(dim)[0] = nrow;
INTEGER(dim)[1] = ncol;
SET_DIM(res, dim);
if (GET_DIMNAMES(m)!= R_NilValue)
SET_DIMNAMES(res, Rf_duplicate(GET_DIMNAMES(m)));
i...