combine multiple stars objects, or combine multiple attributes in a single stars object into a single array

# S3 method for stars
c(..., along = NA_integer_)

Arguments

...

object(s) of class star: in case of multiple arguments, these are combined into a single stars object, in case of a single argument, its attributes are combined into a single attribute. In case of multiple objects, all objects should have the same dimensionality.

along

integer; see read_stars

Examples

tif = system.file("tif/L7_ETMs.tif", package = "stars") x = read_stars(tif) (new = c(x, x))
#> stars object with 3 dimensions and 2 attributes #> attribute(s): #> L7_ETMs.tif L7_ETMs.tif.1 #> Min. : 1.00 Min. : 1.00 #> 1st Qu.: 54.00 1st Qu.: 54.00 #> Median : 69.00 Median : 69.00 #> Mean : 68.91 Mean : 68.91 #> 3rd Qu.: 86.00 3rd Qu.: 86.00 #> Max. :255.00 Max. :255.00 #> dimension(s): #> from to offset delta refsys point values #> x 1 349 288776 28.5 PROJCS["UTM Zone 25, Sout... FALSE NULL [x] #> y 1 352 9120761 -28.5 PROJCS["UTM Zone 25, Sout... FALSE NULL [y] #> band 1 6 NA NA NA NA NULL
c(new) # collapses two arrays into one with an additional dimension
#> stars object with 3 dimensions and 2 attributes #> attribute(s): #> L7_ETMs.tif L7_ETMs.tif.1 #> Min. : 1.00 Min. : 1.00 #> 1st Qu.: 54.00 1st Qu.: 54.00 #> Median : 69.00 Median : 69.00 #> Mean : 68.91 Mean : 68.91 #> 3rd Qu.: 86.00 3rd Qu.: 86.00 #> Max. :255.00 Max. :255.00 #> dimension(s): #> from to offset delta refsys point values #> x 1 349 288776 28.5 PROJCS["UTM Zone 25, Sout... FALSE NULL [x] #> y 1 352 9120761 -28.5 PROJCS["UTM Zone 25, Sout... FALSE NULL [y] #> band 1 6 NA NA NA NA NULL
c(x, x, along = 3)
#> stars object with 3 dimensions and 1 attribute #> attribute(s), summary of first 1e+05 cells: #> L7_ETMs.tif #> Min. : 47.00 #> 1st Qu.: 65.00 #> Median : 76.00 #> Mean : 77.34 #> 3rd Qu.: 87.00 #> Max. :255.00 #> dimension(s): #> from to offset delta refsys point values #> x 1 349 288776 28.5 PROJCS["UTM Zone 25, Sout... FALSE NULL [x] #> y 1 352 9120761 -28.5 PROJCS["UTM Zone 25, Sout... FALSE NULL [y] #> band 1 12 NA NA NA NA NULL