> On Jul 11, 2016, at 1:01 PM, Matthew <mccorm...@molbio.mgh.harvard.edu> wrote: > > I want to get a value that has been assigned to a variable, and then use that > value to be the name of a variable. > > For example, > > tTargTFS[1,1] > # returns: > V1 > "AT1G01010" > > Now, I want to make AT1G01010 the name of a variable: > AT1G01010 <- tTargTFS[-1,1] > > Then, go to the next tTargTFS[1,2]. Which produces > V1 > "AT1G01030" > And then, > AT1G01030 <- tTargTFS[-1,2] > > I want to do this up to tTargTFS[1, 2666], so I want to do this in a script > and not manually. > tTargTFS is a list of 2: chr [1:265, 1:2666], but I also have the data in a > data frame of 265 observations of 2666 variables, if this data structure > makes things easier. > > My initial attempts are not working. Starting with a test data structure that > is a little simpler I have tried: > for (i in 1:4) > { ATG <- tTargTFS[1, i] > assign(cat(ATG), tTargTFS[-1, i]) }
Your efforts will come to naught (or more prezactly... NULL) when you use `cat` as a value. You are essentially doing the R equivalent of answering the question about the sound of one hand clapping. -- David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.