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

Matjaz.

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

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to