Skip to content
Prev 361065 / 398506 Next

if else condition - help

Hi Adrian I'm not sure that you need to use the ifelse here.  You can simply
assign values ina vector or matrix using a simple condition -- here is a simple
example:

v<-c(4,5,6,7)
v1<-v
v1[]<-0
v1[v<5]<--1
v1[v>6]<-1
v1

Nick
Message-ID: <1783757620.1506190.1463940745075.JavaMail.open-xchange@oxbe21.tb.ukmail.iss.as9143.net>
In-Reply-To: <CAL2fYnP3TOHBF=5vsGtpaEM8M8_dOSR26q2rnHhj6jgihNF=ZA@mail.gmail.com>