The inverse of ga_explode(). Concatenates every element's parts into one
array, turning a list of n elements holding m parts in total into an
array of length m.
Arguments
- x
a list array of GeoArrow arrays, as
ga_explode()returns
Details
ga_flatten() adds nothing for null elements, so it returns a different
number of rows than the input whenever an element holds more or fewer than
one geometry.
Examples
fp <- system.file("shape/nc.shp", package = "sf")
nc <- as.data.frame(read_shapefile(fp))
# 100 counties in, one row per polygon part out
length(nc$geometry)
#> [1] 100
ga_flatten(ga_explode(nc$geometry))$length
#> [1] 108