Hi there,
I am pretty new to R. Actually I started using it yesterday. I have two
questions:
1. Suppose I have a<-c(1:10) (or a<-array(c(1:10),dim=c(1,10)))
and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to
substitute alla elements that are <5 with 0 and >5 with
Λεωνίδας Μπαντής wrote:
>
> 1. Suppose I have a<-c(1:10) (or a<-array(c(1:10),dim=c(1,10)))
>
> and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to
> substitute alla elements that are <5 with 0 and >5 with 1.
>
I think you mean >=5, not > 5. In that case, try this:
2009/2/23 Λεωνίδας Μπαντής :
>
> Hi there,
>
> I am pretty new to R. Actually I started using it yesterday. I have two
> questions:
>
> 1. Suppose I have a<-c(1:10) (or a<-array(c(1:10),dim=c(1,10)))
>
> and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to
> substitute alla
On Feb 24, 3:57 pm, jdeisenberg wrote:
> Λεωνίδας Μπαντής wrote:
>
> > 1. Suppose I have a<-c(1:10) (or a<-array(c(1:10),dim=c(1,10)))
>
> > and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to
> > substitute alla elements that are <5 with 0 and >5 with 1.
>
> I think you
4 matches
Mail list logo