On Tue, May 19, 2009 at 12:07 PM, routík <zrou...@gmail.com> wrote:
> > SmoothData <- list(exists=TRUE, span=0.001) > > exists("SmoothData$span") > FALSE > As others have said, this just checks for the existence of a variable with the (strange) name "SmoothData$span". In some sense, in R semantics, xxx$yyy *always* exists if xxx is a list (or other recursive object): > xxx <- list() > xxx$hello NULL You might think that you can check names(xxx) to see if the slot has been explicitly set, but it depends on *how* you have explicitly set the slot to NULL: > xxx$hello <- 3 > xxx$hello <- NULL > names(xxx) character(0) # no names -- assigning to NULL kills slot > xxx <- list(hello=NULL) > names(xxx) [1] "hello" # 1 name -- constructing with NULL-valued slot Welcome to R! -s [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.