knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

fasterRaster GRasters can represent double-floating point numeric values, integers, or categorical data.

Double-floating point values

Double-floating point values are accurate to about the 15th to 17th decimal place. These are called "double" rasters in fasterRaster and DCELL rasters in GRASS. These rasters typically take the most memory. All numeric values in R are double-floating point values.

Floating point values

Less common that double-floating point rasters, floating point rasters are accurate to about the 7th decimal place. These are called "float" rasters in fasterRaster and FCELL rasters in GRASS. These rasters typically take less memory than double-floating point rasters.

Integers

Rasters that represent integers are called "integer" rasters in fasterRaster and CELL rasters in GRASS. You can force a raster to be an integer using as.int(). Some of the functions in app() function will also return integer-type rasters. Integer rasters typically take the least memory.

Categories

Categorical rasters (also called "factor" rasters) are actually integer rasters, but have an associated attribute table that maps each integer value to a category label, such as "wetland" or "forest". The table has at least two columns. The first is integer values, and (by default) the second is category names. This second column is the "active" category column that is used for plotting and in some functions. The active column can be changed using activeCat<-.

Functions relevant to raster data types

Any type of GRaster

Categorical GRasters

Saving rasters to disk

You can potentially save substantial space on disk by setting the datatype argument in writeRaster() to an appropriate value when saving a raster. This argument allows for finer "divisions" than just integer/float/double-float, so depending on the range of values in your raster, you can optimize file size by selecting the one that best matches the values in the raster. See the documentation for writeRaster() for more information.

~ FINIS ~



adamlilith/fasterRaster documentation built on Sept. 23, 2024, 1:28 a.m.