On Tue, 5 Apr 2005, Vadim Ogranovich wrote:
Hi,
Is there a way (or better say idiom) for calling functions like do_inherit() (which are meant to be called via .Internal) from regular C code. Say I have a SEXP object x and I want to check if it inherits from "POSIXt". How do I do this?
Call eval() on the R expression you want. There are lots of examples in the tests/Embedding directory, and the following (in objects.c)
#ifdef UNUSED static void load_methods_package() { SEXP e; R_set_standardGeneric_ptr(dispatchNonGeneric, NULL); PROTECT(e = allocVector(LANGSXP, 2)); SETCAR(e, install("library")); SETCAR(CDR(e), install("methods")); eval(e, R_GlobalEnv); UNPROTECT(1); } #endif
is a simple prototype for such calls.
-- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel