[R] Converting a string to variable names
刘瑞阳
ruiyangliu94 at gmail.com
Tue Nov 14 21:43:22 CET 2017
Hi,
Suppose that I want to do a series of plots with the y value for each plot as PC1, PC2, PC3… How could I accomplish this using a for loop?
Suppose the code like this:
For (index in seq(1,16)){
plot(x=(a given set of value),y=paste(“PC”,as.character(index),sep=“”)
}
But this would not work because y is assigned a string instead of the variable names. So how could I assign y with a variable name instead of a string? Your reply would be appreciated!
Ruiyang Liu
More information about the R-help
mailing list