Many thanks to everyone who chimed in on this one. I really appreciate the time you took to help me. Especially Dave W. who made me question what exactly I was after.
Dan N.'s solution does exactly what I want, and it helped me learn about the eval() and parse() functions too. Thanks again, and all the best. Mark Na On Thu, Jan 17, 2013 at 5:15 PM, Nordlund, Dan (DSHS/RDA) < nord...@dshs.wa.gov> wrote: > > -----Original Message----- > > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > > project.org] On Behalf Of mtb...@gmail.com > > Sent: Thursday, January 17, 2013 2:27 PM > > To: David Winsemius; r-help@r-project.org > > Subject: Re: [R] How to convert a string to the column it represents in > > a dataframe, with a reproducible example > > > > Hi David, > > > > I would like to have two objects, one containing the values in a column > > and > > the other containing the column's name. > > > > Of course, that's easy to do manually, but I don't want to have to type > > out > > the name of the column more than once (thus, below, I have typed it > > once in > > quotes, and I am trying to find a programatic way to create the other > > object, without typing the column name again). > > > > Thank you for your help. > > > > Mark Na > > > > Something like this > > eval(parse(text=y)) > > could be what you want. But even if it is, I am not sure it is what you > should want. Without more context, it is hard to say. > > Hope this is at least somewhat helpful, > > Dan > > Daniel J. Nordlund > Washington State Department of Social and Health Services > Planning, Performance, and Accountability > Research and Data Analysis Division > Olympia, WA 98504-5204 > > > ______________________________________________ > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.