[R] list names

Robert M. Flight rflight79 at gmail.com
Thu Mar 18 18:12:51 CET 2010

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?


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

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 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.

More information about the R-help mailing list