[R] [] vs [[]]
Kaspar Pflugshaupt
pflugshaupt at geobot.umnw.ethz.ch
Fri Oct 20 11:43:55 CEST 2000
On 20.10.2000 10:40 Uhr, Bill Simpson wrote:
> List
>> x<-list(1,2,3,4)
>> x[2]
> [[1]]
> [1] 2
>
>> x[[2]]
> [1] 2
> doesn't seem to matter if you use [] or [[]]
It does!
In the first case, you get back a list with just one item (as you can see by
the [[1]] line). In the second case, it's just the item. That's all the
difference I found, though.
Cheers
Kaspar
--
Kaspar Pflugshaupt
Geobotanisches Institut
Zuerichbergstr. 38
CH-8044 Zuerich
Tel. ++41 1 632 43 19
Fax ++41 1 632 12 15
mailto:pflugshaupt at geobot.umnw.ethz.ch
privat:pflugshaupt at mails.ch
http://www.geobot.umnw.ethz.ch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list