[Rd] R-2.0.0 findVar and findFun question

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Oct 8 15:10:41 CEST 2004


Matjaz Kukar <matjaz.kukar at fri.uni-lj.si> writes:


> 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?

Can't see anything relevant changed recently...

I can see that findFun gives an error if the function is not found,
which I presume is what you call a "crash". However, your workaround
wouldn't catch the situation where a variable exists, but none of the
versions in the search path are functions.

I think you want to use findVar1() instead.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907



More information about the R-devel mailing list