Hi, You may also flatten the list of lists and apply the function. In the example I provided, lapply(do.call(c,unlist(lst1,recursive=FALSE)),sum)
#or use one of the functions from this link http://stackoverflow.com/questions/8139677/how-to-flatten-a-list-to-a-list-without-coercion lapply(flatten2(lst1),sum) A.K. On Tuesday, November 12, 2013 5:05 PM, arun <smartpink...@yahoo.com> wrote: Hi, You may try: (Please provide a reproducible example.) lst1 <- list(list(list(c(14L, 13L, 5L, 4L, 9L), c(14L, 16L, 13L, 2L)), list(c(3L, 2L, 7L, 1L, 8L), c(1L, 9L, 4L, 8L, 7L, 3L, 5L, 2L), c(4L, 2L, 1L))), list(list(c(7L, 14L, 15L, 4L, 3L), c(10L, 12L, 6L, 1L)), list(c(5L, 8L, 10L, 3L, 4L), c(9L, 4L, 2L, 8L, 5L, 7L, 3L, 1L), c(1L, 4L, 3L)))) lapply(lst1,function(x) lapply(x,function(y) lapply(y,function(z) sum(z)))) A.K. I have a list that has a header with the following information. List of 6 $ :List of 3 ..$ :List of 48 The structure of the list from the 1st to 4th looks like this. [[1]] [[1]][[1]] [[2]] [[2]][[2]] [[3]] [[3]][[3]] [[4]] [[4]][[4]] I want to apply a function to the entire list but am unable to do it. How can one apply such a function to the list? ______________________________________________ R-help@r-project.org mailing list 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.