Dear, I have the following list (mylist), in which I need to pass to the column 2 the name of the list itself. So, running the follwing commands:
A= data.frame(1:2,3) B= data.frame(1:4,3) C= data.frame(c(1:2),c(4:5)) mylist=list(A=A,B=A,C=C) lapply(mylist, setNames, paste(c("CaZyme"))) The output would be: > lapply(mylist, setNames, paste(c("CaZyme"))) $A CaZyme NA 1 1 3 2 2 3 $B CaZyme NA 1 1 3 2 2 3 $C CaZyme NA 1 1 4 2 2 5 3 3 6 My question is: How could I name the second column with the name of each dataframe of the list, such that NA would be substitute for A, B and C, respectively. Thank you very much, Andre -- Andre [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.