magclass (version 4.107.0)

mcalc: mcalc

Description

Select values from a MAgPIE-object

Usage

mcalc(x, f, dim = NULL, append = FALSE)

Arguments

x

MAgPIE object

f

A formula describing the calculation that should be performed

dim

The dimension in which the manipulation should take place. If set to NULL function tries to detect the dimension automatically.

append

If set to TRUE the result will be appended to x, otherwise the result will be returned.

Value

The calculated MAgPIE object in the case that append is set to FALSE. Otherwise nothing is returned (as x is appended in place)

Details

This functions only work for MAgPIE objects with named dimensions as the dimension name (set_name) has to be used to indicate in which dimension the entries should be searched for!

See Also

mselect

Examples

Run this code
# NOT RUN {
 data(population_magpie)
 population_magpie
 mcalc(population_magpie,X12 ~ A2*B1,append=TRUE)
 population_magpie
 mcalc(population_magpie,`Nearly B1` ~ 0.5*A2 + 99.5*B1)
 

# }

Run the code above in your browser using DataLab