Get the number of columns of a spatial object.
getCols(x, ...) # S4 method for ANY getCols(x) # S4 method for geom getCols(x) # S4 method for Raster getCols(x) # S4 method for SpatRaster getCols(x) # S4 method for matrix getCols(x)
| x | the object from which to get the number of columns. |
|---|---|
| ... | other arguments. |
An integer of the number of columns.
Other getters:
getCRS(),
getExtent(),
getFeatures(),
getGroups(),
getHistory(),
getLayers(),
getNames(),
getPoints(),
getRes(),
getRows(),
getType(),
getWindow()
getCols(gtGeoms$grid$categorical) #> [1] 60 gc_raster(gtGeoms$grid$categorical) %>% getCols() #> [1] 60 gc_terra(gtGeoms$grid$categorical) %>% getCols() #> [1] 60 getCols(x = matrix(0, 3, 5)) #> [1] 5