Re: [R] which function

From: arnaud Gaboury <arnaud.gaboury_at_gmail.com>
Date: Wed, 02 Jun 2010 10:18:16 +0200

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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 Jun 2010 - 08:22:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jun 2010 - 08:40:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive