Data type of a SpatRaster or SpatVector
datatype.Rd
Get the data types of the fields (attributes, variables) of a SpatVector or of the file(s) associated with a SpatRaster. A (layer of a) SpatRaster has no datatype if it has no values, or if the values are in memory.
Usage
# S4 method for class 'SpatRaster'
datatype(x, bylyr=TRUE)
# S4 method for class 'SpatVector'
datatype(x)
See also
Raster data types
to check / set the type of SpatRaster values.
Examples
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
datatype(v)
#> [1] "double" "string" "double" "string" "double" "long"
f <- system.file("ex/elev.tif", package="terra")
r <- rast(f)
datatype(r)
#> [1] "INT2S"
# no data type
datatype(rast())
#> [1] ""