Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread Robin Jeffries
x <- 1:4 >> > x[x == 1] >> > [1] 1 >> > x <- c(1:4, NA) >> > x[x == 1] >> > [1] 1 NA >> > x[x %in% 1] >> > [1] 1 >> > >> > If so, using %in% is one way to avoid the problem. However, I would >> > have t

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread jim holtman
treats NA: > > > > x <- 1:4 > > x[x == 1] > > [1] 1 > > x <- c(1:4, NA) > > x[x == 1] > > [1] 1 NA > > x[x %in% 1] > > [1] 1 > > > > If so, using %in% is one way to avoid the problem. However, I would > > have thought you

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread Henrique Dallazuanna
d the problem. However, I would > > have thought you'd get an error message if this were the case. > > > > HTH . > > > > Peter Alspach > > > > > -Original Message- > > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread Robin Jeffries
; HTH . > > Peter Alspach > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > > project.org] On Behalf Of Robin Jeffries > > Sent: Monday, 26 April 2010 10:26 a.m. > > To: r-help@r-project.org > > Subject

Re: [R] Obvious reason for not looping twice?

2010-04-25 Thread Peter Alspach
age if this were the case. HTH . Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Robin Jeffries > Sent: Monday, 26 April 2010 10:26 a.m. > To: r-help@r-project.org > Subject: [R] Obvious

[R] Obvious reason for not looping twice?

2010-04-25 Thread Robin Jeffries
Is there an obvious reason why this won't loop to i=2 and beyond? There are many combinations of *st* & *vc* that don't exist in svc. For example, when s=1 there's only an entry at v=1. That's fine, the entry can stay 0. lookup.svc <- array(0,dim=c(length(unique(svc$st)),length(unique(svc$vc))),