Assign character for names of vectors in R -
would know how assign character element name of vector in r.
e.g.
hk=0.55 paste0("rr",hk) [1] "rr0.55"
now i'd do
paste0("rr",hk)<-c(1:10) error in paste0("rr", scale) <- c(1:10) : target of assignment expands object outside language
like leaving vector so
> rr0.55<-c(1:10) > rr0.55 [1] 1 2 3 4 5 6 7 8 9 10
????
thank help
use assign
:
assign(paste0("rr",hk), c(1:10))
Comments
Post a Comment