- 1. Find first consecutive pair in vector (score: 1)
- Author: "Potgieter, Andries B" <Andries.Potgieter@dpi.qld.gov.au>
- Date: Thu, 7 Jul 2005 17:13:58 +1000
- Dear s-list I want to find the first consecutive pair with the first value >0 and the second value > 200 in the following vector: X <- c( 204, -24, -33, 433, -1123, 565, 366, -494, 261, 205, 270, 201
- /archives/html/s-news/2005-07/msg00025.html (9,087 bytes)
- 2. Re: Find first consecutive pair in vector (score: 1)
- Author: Mario Cortina Borja <M.Cortina@ich.ucl.ac.uk>
- Date: Thu, 07 Jul 2005 08:54:42 +0100
- Dear Andries, A function that does that is: find1<- function(X, b1 = 0, b2 = 200) { <x-tab> </x-tab>s1 <- 1:(length(X) - 1) <x-tab> </x-tab>s2 <- s1 + 1 <x-tab> </x-tab>res1 <- s1[X[s1] > b1 & X[s2]
- /archives/html/s-news/2005-07/msg00026.html (9,008 bytes)
- 3. Re: Find first consecutive pair in vector (score: 1)
- Author: "Biggerstaff, Brad J." <bkb5@cdc.gov>
- Date: Thu, 7 Jul 2005 09:41:18 -0600
- <st1:State w:st="on"><st1:place w:st="on">ind</st1:place></st1:State> <- which(X X[<st1:State w:st="on"><st1:place w:st="on">ind</st1:place></st1:State> + 0:1] # so is NA if condition not satisfied<o
- /archives/html/s-news/2005-07/msg00031.html (13,300 bytes)
- 4. Re: Find first consecutive pair in vector (score: 1)
- Author: "Potgieter, Andries B" <Andries.Potgieter@dpi.qld.gov.au>
- Date: Fri, 8 Jul 2005 08:46:25 +1000
- thanks a lot to all your help and quick response on this small problem I had. It is really appreciated.. ap From: Biggerstaff, Brad J. [mailto:bkb5@CDC.GOV] Sent: Friday, 8 July 2005 1:41 AM To: Mari
- /archives/html/s-news/2005-07/msg00037.html (15,169 bytes)
This search system is powered by
Namazu