So I have a list variable, and each item has a name. Is it possible to return just the names in the list and not the contents of each one? Example: Currently, if I have a list variable "matrices", and it contains 3 matrices, "M1", "M2", and "M3", if I type: matrices, R returns $M1 -> listing of numbers in matrix; $M2 -> listing of numbers in matrix, and $M3 -> listing of numbers in the matrix. Is there a way to have it return only the names $M1, $M2, $M3? I know this seems trivial and I'm sure it has been asked before, but I can't find it. Thanks in advance. -Robert Robert M. Flight, Ph.D. Bioinformatics and Biomedical Computing Laboratory University of Louisville Louisville, KY PH 502-852-0467 EM robert.flight at louisville.edu EM rflight79 at gmail.com Williams and Holland's Law: If enough data is collected, anything may be proven by statistical methods.
Robert M. Flight wrote:> > So I have a list variable, and each item has a name. Is it possible to > return just the names in the list and not the contents of each one? > > Example: > > Currently, if I have a list variable "matrices", and it contains 3 > matrices, "M1", "M2", and "M3", if I type: > > matrices, R returns $M1 -> listing of numbers in matrix; $M2 -> > listing of numbers in matrix, and $M3 -> listing of numbers in the > matrix. > > Is there a way to have it return only the names $M1, $M2, $M3? > > I know this seems trivial and I'm sure it has been asked before, but I > can't find it. > > Thanks in advance. > > -Robert >?names The help.search() function can be useful for finding functions when you know what you want to get done, but not which function does it. For example: help.search( "names" ) Would list several functions and their descriptions would help you find the one you wanted. -Charlie ----- Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/list-names-tp1598316p1598330.html Sent from the R help mailing list archive at Nabble.com.
On Mar 18, 2010, at 1:12 PM, Robert M. Flight wrote:> So I have a list variable, and each item has a name. Is it possible to > return just the names in the list and not the contents of each one??names> > Example: > > Currently, if I have a list variable "matrices", and it contains 3 > matrices, "M1", "M2", and "M3", if I type: > > matrices, R returns $M1 -> listing of numbers in matrix; $M2 -> > listing of numbers in matrix, and $M3 -> listing of numbers in the > matrix. > > Is there a way to have it return only the names $M1, $M2, $M3? > > I know this seems trivial and I'm sure it has been asked before, but I > can't find it. > > Thanks in advance. > > -Robert > > Robert M. Flight, Ph.D. > Bioinformatics and Biomedical Computing Laboratory > University of Louisville > Louisville, KY > > PH 502-852-0467 > EM robert.flight at louisville.edu > EM rflight79 at gmail.com > > Williams and Holland's Law: > If enough data is collected, anything may be proven by > statistical methods. > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT