GRTSmaster_habitatsdata source to base 4 fractions
Converts decimal (i.e. base 10) integer values from the raster data source
GRTSmaster_habitats into base 4 fractions, using a precision of
13 digits behind the decimal mark (as needed to cope with the range of
For example, the integer
= 4^2) is converted into
4^12 is converted into
A decimal (i.e. base 10) scalar or vector of integer values from the
The corresponding base4 scalar or vector, stored as a fraction.
Long base 4 fractions seem to be handled and stored easier than long (base 4) integers. This approach follows the one of Stevens & Olsen (2004) to represent the reverse hierarchical order in a GRTS sample as base-4-fraction addresses.
The function works on a vector and retains
As such, it can be used in
When writing such a raster to a file, it is needed to use the
data type (see
Otherwise several digits will change.
The function is based on code from the
in Will Gray's Gmisc package.
Stevens D.L. & Olsen A.R. (2004). Spatially Balanced Sampling of Natural Resources. Journal of the American Statistical Association 99 (465): 262–278. doi:10.1198/016214504000000250 .