[R] substituting an object not found

Gabor Csardi csardi at rmki.kfki.hu
Fri Jan 27 13:48:59 CET 2006


> rm(list=ls())
> a <- 1
> ifelse(exists("b"), b, a)
[1] 1
> b <- 2
> ifelse(exists("b"), b, a)
[1] 2
> 

Gabor

On Fri, Jan 27, 2006 at 04:38:39AM -0800, Mikkel Grum wrote:
> Is there any function in R like
> 
> is.not.found(x, y)  
> 
> meaning if you can't find object x, then use object
> y??
> 
> 
> Mikkel Grum
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    MTA RMKI, ELTE TTK




More information about the R-help mailing list