On Jan 28, 2012, at 3:45 PM, Dimitris Rizopoulos wrote:
how about
x[x < 10 & !is.na(x)]
Besides this and the which() strategy there is also:
subset(x, x<10)
I hope it helps.
Best,
Dimitris
On 1/28/2012 9:36 PM, Federico Calboli wrote:
Dear All,
just a quick example:
x = 1:25
x[
how about
x[x < 10 & !is.na(x)]
I hope it helps.
Best,
Dimitris
On 1/28/2012 9:36 PM, Federico Calboli wrote:
Dear All,
just a quick example:
x = 1:25
x[12] = NA
x
[1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14 15 16 17 18 19 20 21 22 23 24 25
y = x[x<10]
y
[1] 1 2 3 4 5
Hi,
which(x < 15)
omits the NA (treated as false).
HTH,
b.
On 29 January 2012 09:36, Federico Calboli wrote:
> Dear All,
>
> just a quick example:
>
>
>> x = 1:25
>> x[12] = NA
>
>> x
> [1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14 15 16 17 18 19 20 21 22 23 24 25
>
>> y = x[x<10]
>> y
> [1] 1 2
x[which(x < 10)]
Michael
On Sat, Jan 28, 2012 at 3:36 PM, Federico Calboli
wrote:
> Dear All,
>
> just a quick example:
>
>
>> x = 1:25
>> x[12] = NA
>
>> x
> [1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14 15 16 17 18 19 20 21 22 23 24 25
>
>> y = x[x<10]
>> y
> [1] 1 2 3 4 5 6 7 8 9 NA
>
> Is
Dear All,
just a quick example:
> x = 1:25
> x[12] = NA
> x
[1] 1 2 3 4 5 6 7 8 9 10 11 NA 13 14 15 16 17 18 19 20 21 22 23 24 25
> y = x[x<10]
> y
[1] 1 2 3 4 5 6 7 8 9 NA
Is there any way of NOT getting NA for y = x[x<10]? Similarly
> y = x[x<15]
> y
[1] 1 2 3 4
5 matches
Mail list logo