[R] How to write a list object's name to a new dataframe in that list object

Mark Na mtb954 at gmail.com
Sat Oct 8 05:17:22 CEST 2011


Hello R-helpers,

I have a list that only contains dataframes. Each element of the list
(i.e., each dataframe) has a unique name ("one" through "ten"). I wish
to add a new column (called "NAME") to each list element (i.e each
datarame) and I want that column to contain the name of it's list
element.

e.g. the list element (i.e., dataframe) called "one" would get a new
column called "NAME" that would contain the word "one" in every row.

Could anyone help with that?

Many thanks,

Mark Na



More information about the R-help mailing list