Re: [Rd] R-2.0.0 findVar and findFun question

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Fri 08 Oct 2004 - 23:10:41 EST

Matjaz Kukar <matjaz.kukar@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@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Oct 08 23:28:12 2004

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