[R] change the value of vector based on the string of its name

Qill Bel qillbel at gmail.com
Fri Mar 24 18:12:08 CET 2017


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]]



More information about the R-help mailing list