Skip to content
Prev 42820 / 398506 Next

Extracting multiple elements from a list

For the first case, I actually do this pretty often and usually use 
something like:

as.vector(sapply(alist, "[[", "vec"))

For the second case, I think you just need to use lapply():

alist <- lapply(seq(along = alist), function(i)
		alist[[i]]$name <- new.names[i])

-roger
Waichler, Scott R wrote: