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

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -