Skip to content
Prev 180879 / 398525 Next

exists function on list objects gives always a FALSE

?rout?k wrote:
This checks for existance of an object called "SmoothData$span", as in :

`SmoothData$span` <- 1:10
exists("SmoothData$span")

You can do:

is.list( SmoothData ) && !is.null(names(SmoothData)) && "span" %in% 
names(SmoothData)
Similarly:

`SmoothData[[2]]` <- 1
exists("SmoothData[[2]]")

You can do:

is.list( SmoothData ) && length(SmoothData) > 1