[Rd] R-2.0.0 findVar and findFun question

From: Matjaz Kukar <matjaz.kukar_at_fri.uni-lj.si>
Date: Fri 08 Oct 2004 - 21:21:53 EST

Dear all,

when working on a project with embedded R, I found out that R-2.0.0 causes a problem where older versions worked OK.

Rf_findVar(...) causes the following error when used to find a generic function (such as print):

fun = Rf_findVar(...);
R_tryEval(fun, ...);

Error in function (object, ...) : Invalid generic function in usemethod

Alternatively, using Rf_findFun(...) seems OK in this context, but crashes if you call it with an unexisting function name. Rf_findVar does not crash in this case, but returns an unbound value.

My workaround for now is as follows:

    fun = Rf_findVar(Rf_install(ident), R_GlobalEnv);     if (fun != R_UnboundValue) {

        fun = Rf_findFun(Rf_install(ident), R_GlobalEnv);
        R_tryEval(fun, ...);


I did some checking on the R object pointers and indeed for generic functions Rf_findFun and Rf_findVar return different pointers (and therefore different function objects).

What has changed with these functions? Can you comment on my workaround and suggest a better (proper?) way of doing this?

Platform: Windows XP, R-2.0.0, MS VSC++ 7.0


dr. Matjaz Kukar
Univerza v Ljubljani
Fakulteta za racunalnistvo in informatiko
Trzaska 25, 1001 Ljubljana

R-devel@stat.math.ethz.ch mailing list
Received on Fri Oct 08 21:36:35 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:30 EST