[R] which function
arnaud Gaboury
arnaud.gaboury at gmail.com
Wed Jun 2 10:18:16 CEST 2010
The correct line is :
> l[(which(100420==l)-1):which(100420==l)]
[1] "100419" "100420"
> -----Original Message-----
> From: arnaud Gaboury [mailto:arnaud.gaboury at gmail.com]
> Sent: Wednesday, June 02, 2010 9:41 AM
> To: r-help at r-project.org
> Cc: 'arnaud Gaboury'
> Subject: which function
>
> Dear group,
>
> Here is a list of elements :
>
>
> l <-
> c("100415", "100416", "100419", "100420", "100421", "100422",
> "100423", "100426", "100427", "100428", "100429", "100430", "100503",
> "100504", "100505", "100506", "100507", "100510", "100511", "100512",
> "100513", "100514", "100517", "100518", "100519", "100520", "100521",
> "100524", "100525", "100526", "100527", "100528", "100531")
>
>
> > l[3:4]
> [1] "100419" "100420" #result is fine
>
>
> > l[(which(100420==l))-1:which(100420==l)]
> [1] "100419" "100416" "100415" #can't understand why I do not have
> same
> result than the above line
>
>
> Thank You for help
More information about the R-help
mailing list