Displaying 1 result from an estimated 1 matches for "prerecreate".
Did you mean:
precreate
2005 Mar 16
1
returning NULL from .Call call
...essage and R-session closes. The question is, what would be a working
way to return anything like NULL, something to check with is.null(...)?
Now the way around (just in case it might be of interest), slightly
modified function returning numeric(0) on fail:
SEXP loadData(SEXP fileName) {
// prerecreate and protect a non-NULL return value: numeric(0)
SEXP result = allocVector(INTSXP, 0);
PROTECT(result);
int* data = NULL;
try {
// try to open the file and read the data into 'data'
} catch(...) {
std::cout << "Load failed (ANY REASON) - returning...