contingencyTable {OpenLand} | R Documentation |
Contingency table
Description
Extracts LUC transitions for all input grids of the time series.
Usage
contingencyTable(input_raster, pixelresolution = 30)
Arguments
input_raster |
path (character), Raster* object or list of Raster*
objects. See |
pixelresolution |
numeric. The pixel spatial resolution in meter. |
Value
A list that contains 5 objects.
-
lulc_Mulstistep
:<tibble>
Contingency table for all analysed time steps, containing 8 columns:Period:
<chr>
The period [Yt, Yt+1].From:
<dbl>
numerical code of a LUC category i.To:
<dbl>
numerical code of a LUC category j.km2:
<dbl>
Area in square kilometers that transited from the category i to category j in the period from Yt to Yt+1.Interval:
<dbl>
Interval of years between the first and the last year of the period [Yt, Yt+1].QtPixel:
<int>
Pixel count that transited from the categories i to category j in the period from Yt to Yt+1.yearFrom:
<chr>
The year that the change comes from [Yt].yearTo:
<chr>
The year that the change goes for [Yt+1].
-
lulc_Onestep
:<tibble>
Contingency table for the entire analysed period [Y1, YT], containing 8 columns identical withlulc_Mulstistep
. -
tb_legend
:<tibble>
A table of the pixel value, his name and color containing 3 columns:categoryValue:
<dbl>
the pixel value of the LUC category.categoryName:
<factor>
randomly created string associated with a given pixel value of a LUC category.color:
<chr>
random color associated with the given pixel value of a LUC category. Before further analysis, one would like to change thecategoryName
andcolor
values.Therefore the category names have to be in the same order as the
categoryValue
and thelevels
should be put in the right order for legend plotting. Like:myobject$tb_legend$categoryName <- factor(c("name1", "name2", "name3", "name4"), levels = c("name3", "name2", "name1", "name4"))
The colors have to in the same order as the values in the
categoryValue
column. Colors can be given by the color name (eg. "black") or an HEX value (eg. #FFFFFF). Like:myobject$tb_legend$color <- c("#CDB79E", "red", "#66CD00", "yellow")
-
totalArea
:<tibble>
A table with the total area of the study area containing 2 columns:area_km2:
<numeric>
The total area in square kilometers.QtPixel:
<numeric>
The total area in pixel counts.
-
totalInterval
:<numeric>
Total interval of the analysed time series in years.
Examples
url <- "https://zenodo.org/record/3685230/files/SaoLourencoBasin.rda?download=1"
temp <- tempfile()
download.file(url, temp, mode = "wb") #downloading the online dataset
load(temp)
# the contingencyTable() function, with the SaoLourencoBasin dataset
contingencyTable(input_raster = SaoLourencoBasin, pixelresolution = 30)