count_predictions: Soil class prediction counts

View source: R/dsmartr_collate.R

count_predictionsR Documentation

Soil class prediction counts

Description

Counts the number of times a given soil class was predicted on a pixel

Usage

count_predictions(input = NULL, n_classes = NULL)

Arguments

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.

Value

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.

Note

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.

Examples

## 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)


obrl-soil/dsmartr documentation built on Feb. 1, 2024, 10:57 p.m.