Hi everyone,

My help request is similar to what was asked by Ken Termiso on April 18th, 
2005. Link here: https://stat.ethz.ch/pipermail/r-help/2005-April/069729.html

Matt Wiener answered with suggesting a vector list where you hand type each of 
the vectors. This is not what I want to do. What I want to do is automate the 
process. So, in other words creating a list through a loop. 

For example:

My data frame is called "df" and I have four variables/vectors that are v7, v8, 
v9, 10. Each variable/vector is an integer (no character strings). I want to 
create a list called "Indexes" so that I can use this list for "for-in" loops 
to SEPARATELY plot each and every variable/vector. 

If I followed Matt Wiener's suggestion, I would input this:


Indexes = list()
Indexes[[1]] = df$v7 
Indexes[[2]] = df$v8
Indexes[[3]] = df$v9
Indexes[[4]] = df$v10

But if I want to include more than four variable/vectors (let's say I want to 
include 25 of them!), I do not want to have to type all of it. If I do the 
following command:

Indexes <- c(df$v7, df$v8, df$v9, df$v10)

then I run into the same problem as Ken Termiso with having all the integers in 
one vector. I need to keep the variables/vectors separate. 

Is this just not possible in R? Any help would be great. Thank you!

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to