[R] Is it a bug in list() behavior?
Uwe Ligges
ligges at statistik.uni-dortmund.de
Mon Mar 24 16:54:43 CET 2003
wolski wrote:
> Hello!
>
> let:
>
> test<-1:3
> list(test)
> names(test)<-c("X11","X12","Y23")
>
>>test[["Y2"]]
>
> 3
>
> I had assumed that the names in a list are like a keys in a hash.
> Therefore i thought that no value should be returned.
>
> The behavior of:
>
>
>>test["Y2"]
>
> <NA>
> NA
>
> is as i expected.
>
>
> Should it be as it is? How is the definition of [[]] and []?
No! See "An Introduction to R", Section 6.1:
"The names of components may be abbreviated down to the minimum number
of letters needed to identify them uniquely. Thus Lst$coefficients may
be minimally specified as Lst$coe and Lst$covariance as Lst$cov."
Uwe Ligges
More information about the R-help
mailing list