View source: R/dsmartr_collate.R
count_predictions | R Documentation |
Counts the number of times a given soil class was predicted on a pixel
count_predictions(input = NULL, n_classes = NULL)
input |
A vector of integers n model runs long, where the integers refer to soil classes. |
n_classes |
Integer; the total number of soil classes available to predict. |
An atomic vector of prediction counts, or a vector of NA values of the same length. e.g. 0 5 8 0 == soil 1 was not predicted, soil 2 was predicted 5 times, soil 3 was predicted 8 times, soil 4 was not predicted.
This is a helper function and not widely applicable. It is expected to
be used in concert with calc
, applied to a stack
of model realisations produced by iterate
.
## Not run:
# 100 model runs, from a cell in the middle of the heronvale demo dataset
cell_19291 <- c(29, 7, 7, 7, 12, 9, 29, 29, 29, 3, 16, 15, 9, 21, 24, 2, 9,
15, 34, 9, 24, 34, 24, 34, 21, 24, 15, 15, 9, 21, 21, 7, 7, 34, 34, 15, 15,
21, 7, 30, 32, 21, 29, 21, 24, 29, 31, 12, 24, 12, 21, 15, 15, 29, 12, 7, 21,
12, 7, 34, 9, 32, 7, 7, 32, 32, 12, 34, 29, 7, 3, 15, 15, 29, 7, 3, 34, 9, 9,
33, 32, 21, 34, 29, 33, 7, 7, 31, 7, 7, 24, 21, 15, 7, 24, 29, 21, 31, 29,
15, 7)
count_predictions(cell_19291)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.