Inline below. -- Bert
On Thu, Jan 17, 2013 at 3:02 PM, David Winsemius <dwinsem...@comcast.net> wrote: > > On Jan 17, 2013, at 2:26 PM, mtb...@gmail.com wrote: > >> Hi David, >> >> I would like to have two objects, one containing the values in a column and >> the other containing the column's name. > > You have not addressed the question ... why? Where are you going with this? > >> 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). > > I would think that this is be best way to proceed: > > x <- cars[ , "dist", drop=FALSE] > > Now "x" is a data.frame (and inherits from the list-class) and names(x) will > return "dist" and the usual access methods would work. ... which, of course, begs the question: why bother. as you would do the same with the original data frame. -- Bert > > -- > David. >> >> Thank you for your help. >> >> Mark Na >> >> >> On Thu, Jan 17, 2013 at 4:06 PM, David Winsemius <dwinsem...@comcast.net> >> wrote: >> >> On Jan 17, 2013, at 1:36 PM, mtb...@gmail.com wrote: >> >> > Hello R-helpers, >> > >> > I have run the following lines of code: >> > >> > x<-"cars$dist" >> > y<-noquote(x) >> > >> > >> > Now y is a string containing the characters "cars$dist" >> > >> > My question....is there an R function (or combination of functions) that I >> > can apply to y that will cause y to contain the numbers in cars$dist? Even >> > better, can I do it without using noquote()? >> >> What is the goal of this effort? >> >> -- >> >> David Winsemius >> Alameda, CA, USA >> >> > > David Winsemius > Alameda, CA, USA > > ______________________________________________ > 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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm ______________________________________________ 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.