[R] list names

David Winsemius dwinsemius at comcast.net
Thu Mar 18 18:28:47 CET 2010


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



More information about the R-help mailing list