Reputation: 211
This seems like it should be a simple task, but I've been trying for hours with no luck. I think I can explain my problem without providing example data.
I am trying to concatenate objects in a list into a single object. For example, I have a series of stars objects in a list called ncdf
from which I can pull elements in the basic way:
ncdf[[1]]
will extract the first element
ncdf[[2]]
will extract the second, and so forth.
Using stars, I am able to combine them into a single object using the base concatenate function c()
. I can get the result I want manually by coding like so: y <- c(ncdf[[1]], ncdf[[2]])
My question is, I want to be able to concatenate n objects in my list. So if my list is comprised of 1000 stars objects, I obviously would not write y <- c(ncdf[[1]], ncdf[[2]],...,ncdf[[1000]]
all the way to 1000. Is there a loop or some other way I could combine n list items into a single object??
Thanks so much.
Upvotes: 0
Views: 204