getCPR: Get cells per region

View source: R/getCPR.R

getCPRR Documentation

Get cells per region

Description

Counts how often each element of the provided subdimension exists in the given data set. Originally created to count the number of cells in a region (this is also where its name originates from) it can now be used to count elements of any subdimension via the dim argument.

Usage

getCPR(x, dim = 1.1)

Arguments

x

MAgPIE object or a resolution written as numeric (currently only data for 0.5 degree resolution is available).

dim

Dimension for which the items should be returned. Either number or name of dimension or a vector of these (in case of a vector all subimensions must belong to the same main dimension!). See dimCode for more details.

Value

cells per region

Author(s)

Jan Philipp Dietrich

See Also

getRegions, read.magpie, write.magpie

Examples


getCPR(0.5)
a <- maxample("animal")
getCPR(a, dim = "color")
getCPR(a, dim = 3.2)
getCPR(a, dim = "country")
getCPR(a, dim = c("color", "species"))

magclass documentation built on July 9, 2023, 7:03 p.m.