SImpler:
for(nm in names(L) ) L[[nm]] [[nm]] <- nm
However, note that you could also attach the name to each data frame as a,
say, "name" attribute and avoid the extra column.
-- Bert
On Fri, Oct 7, 2011 at 8:42 PM, R. Michael Weylandt <
michael.weyla...@gmail.com> wrote:
> It's inefficient b
It's inefficient but try this:
Suppose your list is L:
mapply(function(x,y) cbind(x, data.frame(NAME=rep(y,NROW(x, L, names(L),
simplify = F)
Code is untested however - let me know if this doesn't work and I'll get to a
computer and clean it up.
Michael Weylandt
On Oct 7, 2011, at 11:1
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
3 matches
Mail list logo