Hi, all I want to take a vector of component names of a list. list.a <- list('x'=1, 'y'=2) how to get a c('x','y') from list.a? Thanks in advance, Hyunchul [[alternative HTML version deleted]]
Try this: names(list.a) On Sun, Aug 29, 2010 at 12:51 PM, Hyunchul Kim <hyunchul.kim.sfc@gmail.com>wrote:> Hi, all > > I want to take a vector of component names of a list. > > list.a <- list('x'=1, 'y'=2) > > how to get a c('x','y') from list.a? > > Thanks in advance, > > Hyunchul > > [[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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
check at the online help file of function ?names(), and then try this: names(list.a) I hope it helps. Best, Dimitris On 8/29/2010 5:51 PM, Hyunchul Kim wrote:> Hi, all > > I want to take a vector of component names of a list. > > list.a<- list('x'=1, 'y'=2) > > how to get a c('x','y') from list.a? > > Thanks in advance, > > Hyunchul > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014