[R] list names

Sharpie chuck at sharpsteen.net
Thu Mar 18 18:28:05 CET 2010



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.



More information about the R-help mailing list