Youve got a dataframe
with columns named "w,x,y,z" . Just do
data$names <- rownames(data)
to add a new column.
edit
In response to Boogie's query, here's lapply
with an anonymous function to do the loop.
foo = as.data.frame(matrix(1:15,3,5))
rownames(foo) <-c('frist','prime','lastly')
foo
bar = list(foo,t(foo), rbind(foo,foo))
bar[[1]] = as.data.frame( foo)
bar[[2]] =data.frame( t(foo))
bar[[3]] = data.frame(rbind(foo,foo))
bar
bar = lapply(bar,FUN= function(x) { x$date <-rownames(x);return(x)})
bar