[R] [[]] confusion

Sam Steingold sds at gnu.org
Tue Feb 15 17:40:13 CET 2011


what does the output for [[]] mean here:
> all$X.Time[5]
[1] "2011-02-15 09:32:26.37222"
> all$X.Time[[5]]
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> all$X.Time[1]
[1] "2011-02-15 09:31:29.18761"
> all$X.Time[[1]]
 [1] 29.18761 34.30949 36.38144 12.28500 26.37222 47.00837 40.20271 32.83765
 [9] 54.56998 28.56961 55.96641 28.91920 32.29962 10.94081 34.31731  3.21796
[17] 58.12660 19.69056 55.99009 45.76731 46.52072

also,
> all$X.Time[0]
character(0)

why no error? I thought that vectors were 1-based.


-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final)
http://www.memritv.org http://iris.org.il
http://honestreporting.com http://palestinefacts.org
OK, so you're a Ph.D.  Just don't touch anything.



More information about the R-help mailing list