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
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
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-
; 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
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
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))),
6 matches
Mail list logo