I am looking to create a list of vectors to which I want to assign specific value. I know I can do something like
var_list=c(V1, V2...etc)
Then use var_list[i] in a for loops. To do this thought, I have to manually creates the list at first, which is long. I know I can do something like
for(i in 1:n){
assign(paste("Mx", i, sep = ""), i)
}
This will creates my variable name. Trouble is, how do I manage them? I would like a way to do something like this :
for(i in 1:n){
attributes(assign(paste("Mx", i, sep = ""), i))<-list(dim=1:n)
"here I would like to append the newly created variable (Mx"i") into a list so I could manage the whole thing later on".
}
So I could do :
for (k in 1:n){
for (j in 1:m)
new_list[[k]][j]<-other_list[[k]][(j-1)*3+1]
}
Any1 got a idea? The basic problem is that I have this long list of vector (which is represented here by "other_list"). Each vector in this list has 36 entry. I want to divide each of these vector in three different vector (I need to specify the specific value of the vector from "other_list" I want to apply to the specific value of the vector of the " new_list ". Thanks !
assignis not a function which should be used by beginners. It usually offers only an apparent solution that makes subsequent steps only harder for you.