Thank you â thatâs sorted it. Trying to make things too complicated! J
From: Alain Guillet-2 [via R]
[mailto:ml-node+1819104-1154170184-120...@n4.nabble.com]
Sent: 09 April 2010 10:34
To: Paul Chatfield
Subject: Re: NAs are not allowed in subscripted assignments
Maybe you can withdr
Hi Paul,
what's wrong with
new[new>5.5]<-NA ?
Btw. your variable new has a length of 5 not 6.
hth.
Am 09.04.2010 11:23, schrieb Paul Chatfield:
>
> I'm trying to assign NAs to values that satisfy certain conditions (more
> complex than shown below) and it gives the right result, but breaks the lo
Sorry I forgot to add that you don't need the for loop:
new[new>5.5] <- NA
new
[1] 5 5 5 5 NA
Alain
On 09-Apr-10 11:23, Paul Chatfield wrote:
new<-c(rep(5,4),6)
for (i in 1:6)
{new[new[i]>5.5][i]<-NA}
--
Alain Guillet
Statistician and Computer Scientist
SMCS - IMMAQ - Université c
Maybe you can withdraw the [i] in your code...
> for (i in 1:6)
+ {new[new[i]>5.5]<-NA}
> new
[1] 5 5 5 5 NA
Alain
On 09-Apr-10 11:23, Paul Chatfield wrote:
I'm trying to assign NAs to values that satisfy certain conditions (more
complex than shown below) and it gives the right result, b
I'm trying to assign NAs to values that satisfy certain conditions (more
complex than shown below) and it gives the right result, but breaks the loop
having done the first one viz:
new<-c(rep(5,4),6)
for (i in 1:6)
{new[new[i]>5.5][i]<-NA}
gives the correct result, though an error message appear
On Thu, 8 Jan 2009, Rune Schjellerup Philosof wrote:
Browse[1]> j <- c(1,2,NA)
Browse[1]> j[j==1][-1]
[1] NA
Browse[1]> j[j==1][-2]
[1] 1
Browse[1]> j[j==1][-2] <- 2
Error during wrapup: NAs are not allowed in subscripted assignments
As far as I can see, I have no NA in the lhs (not after the s
Browse[1]> j <- c(1,2,NA)
Browse[1]> j[j==1][-1]
[1] NA
Browse[1]> j[j==1][-2]
[1] 1
Browse[1]> j[j==1][-2] <- 2
Error during wrapup: NAs are not allowed in subscripted assignments
As far as I can see, I have no NA in the lhs (not after the second
subscript anyway).
Besides, I have a single value
7 matches
Mail list logo