Great! Thanks, Aravind. On Monday, February 16, 2015 10:50 PM, Aravind Jayaraman <aravindjayaramana...@gmail.com> wrote:
Hi, I think you need not split the data.frame to get the desired result. You can work with your list lst4 itself. #Convert the vectors in the list to data.frames. lst4 <- lapply(lst4, function(x) {as.data.frame(t(iris1.csv))}) #Get the data.frames in the list to the global environment list2env(lst4 ,.GlobalEnv) Regards On 17 February 2015 at 09:23, Zilefac Elvis via R-help <r-help@r-project.org> wrote: > Hi All,I have a dataframe called 'means' as shown below:iris1.csv <- iris > iris2.csv <- iris > names <- c("iris1.csv", "iris2.csv") > dat <- mget(names) > lst4 <- lapply(dat, function(x) apply(x[,-5], 2, mean)) > > # Build the new data frame > means <- as.data.frame(do.call(rbind, lst4)) > means$source <- names(lst4) > means > # Sepal.Length Sepal.Width Petal.Length Petal.Width isv > source > # iris1.csv 5.843333 3.057333 3.758 1.199333 0.3333333 > iris1.csv > # iris2.csv 5.843333 3.057333 3.758 1.199333 0.3333333 > iris2.csvQUESTION: How can I split 'means' such that there are two files > (dataframes) on my workspace:datframe 1# Sepal.Length Sepal.Width > Petal.Length Petal.Width isv > # iris1.csv 5.843333 3.057333 3.758 1.199333 > 0.3333333dataframe 2:# Sepal.Length Sepal.Width Petal.Length > Petal.Width isv# iris2.csv 5.843333 3.057333 3.758 > 1.199333 0.3333333 > Many thanks,Asong. > [[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. -- J.Aravind Scientist Germplasm Conservation Division ICAR-National Bureau of Plant Genetic Resources New Delhi - 110 012 [[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.