Hi Qill, If I have interpreted your example correctly: proc1<-0 proc2<-0 cpd<-c("proc1","proc2") assign("proc1",which(cpd=="proc1"))
Jim On Sat, Mar 25, 2017 at 4:12 AM, Qill Bel <qill...@gmail.com> wrote: > Dear R-users, > > Imagine I have 3 vectors: > *proc1<-0* > *proc2<-0* > *cpd<-c("proc1","proc2")* > > How can I change the value of proc1 to 1, based on vector cpd only? > I tried with *as.factor(cpd[1])<-1*, but it produces an error. > > Any idea how could I achieve that? > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.