ounces@r-
>> project.org] On Behalf Of Jessica Streicher
>> Sent: Monday, October 08, 2012 9:19 AM
>> To: Mike Spam
>> Cc: r-help@r-project.org
>> Subject: Re: [R] Simple - Finding vector in a vector
>>
>> > x<-c(NA , 1 ,NA, 1 , 1 , 1 , 1 , 1 ,1 ,N
be something like,
1 1 1 3 3 3 3 1 1
but anyway i can work with rle, if there is no suitable function.
thanks,
Nico
2012/10/8 Mike Spam :
> Hey Rui,
>
> Perfect! Thanks!! :)
>
> Nico
>
> 2012/10/8 Rui Barradas :
>> Hello,
>>
>> See ?rle
>>
>&
Hey Rui,
Perfect! Thanks!! :)
Nico
2012/10/8 Rui Barradas :
> Hello,
>
> See ?rle
>
> Hope this helps,
>
> Rui Barradas
> Em 08-10-2012 13:55, Mike Spam escreveu:
>>
>> Hi,
>>
>> just a simple question.
>> Assumed i have a vector,
>&
Hi,
just a simple question.
Assumed i have a vector,
FALSE TRUE TRUE TRUE FALSE TRUE FALSE TRUE FALSE
or
NA 1 1 1 NA 1 NA 1 NA
what i need is the position where an element is the same - three (or
in general multiple) times in a row.
in this case: i want to get the position where it is
gt; }
>>
>> return(NULL)
>> }
>>
>>> system.time(for(i in 1:100)which(x>0.999)[1])
>> utilisateur système écoulé
>> 9.740 5.795 15.890
>>> system.time(for(i in 1:100)which.max(x>0.999))
>> utilisateur système écoul
Hi,
Thanks Michael, but i think this is even slower.
x <-sample(2000)
which(x < 5)[1]
which.max(x < 5)
system.time(for(i in 1:100) which.max(x < 5))
User System verstrichen
60.84 13.70 86.33
system.time(for(i in 1:100) which(x < 5)[1])
User Syste
Hi,
I was looking for a function like "which()" but only returns the first argument.
Compare:
x <- c(1,2,3,4,5,6)
y <- 4
which(x>y)
returns:
5,6
which(x>y)[1]
returns:
5
which(x>y)[1] is exactly what i need. I did use this but the dataset
is too big (~18 mio. Points).
That's why i need a more
7 matches
Mail list logo