Learn R Programming

Data Class and Tools for Handling Spatial-Temporal Data

R package magclass, version 6.13.2

Purpose and Functionality

Data class for increased interoperability working with spatial-temporal data together with corresponding functions and methods (conversions, basic calculations and basic data manipulation). The class distinguishes between spatial, temporal and other dimensions to facilitate the development and interoperability of tools build for it. Additional features are name-based addressing of data and internal consistency checks (e.g. checking for the right data order in calculations).

Installation

For installation of the most recent package version an additional repository has to be added in R:

options(repos = c(CRAN = "@CRAN@", pik = "https://rse.pik-potsdam.de/r/packages"))

The additional repository can be made available permanently by adding the line above to a file called .Rprofile stored in the home folder of your system (Sys.glob("~") in R returns the home directory).

After that the most recent version of the package can be installed using install.packages:

install.packages("magclass")

Package updates can be installed using update.packages (make sure that the additional repository has been added before running that command):

update.packages()

Tutorial

The package comes with vignettes describing the basic functionality of the package and how to use it. You can load them with the following command (the package needs to be installed):

vignette("magclass-concept")   # Concept behind magclass
vignette("magclass-expansion") # MAGPIE Class Object Expansion
vignette("magclass")           # MAGPIE Class Tutorial
vignette("magclass6")          # magclass 6

Questions / Problems

In case of questions / problems please contact Jan Philipp Dietrich dietrich@pik-potsdam.de.

Citation

To cite package magclass in publications use:

Dietrich J, Bodirsky B, Bonsch M, Humpenoeder F, Bi S, Karstens K, Leip D, Sauer P (2024). magclass: Data Class and Tools for Handling Spatial-Temporal Data. doi: 10.5281/zenodo.1158580 (URL: https://doi.org/10.5281/zenodo.1158580), R package version 6.13.2, <URL: https://github.com/pik-piam/magclass>.

A BibTeX entry for LaTeX users is

@Manual{,
 title = {magclass: Data Class and Tools for Handling Spatial-Temporal Data},
 author = {Jan Philipp Dietrich and Benjamin Leon Bodirsky and Markus Bonsch and Florian Humpenoeder and Stephen Bi and Kristine Karstens and Debbora Leip and Pascal Sauer},
 year = {2024},
 note = {R package version 6.13.2},
 doi = {10.5281/zenodo.1158580},
 url = {https://github.com/pik-piam/magclass},
}

Copy Link

Version

Install

install.packages('magclass')

Monthly Downloads

389

Version

6.13.2

License

LGPL-3 | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Jan Dietrich

Last Published

January 19th, 2024

Functions in magclass (6.13.2)

convergence

convergence
escapeRegex

escapeRegex
magpie_expand

magpie_expand
getCPR

Get cells per region
hasCoords

Has Coordinates
getCells

Get Cells
getDim

getDim
getItems

Get Items
mselect

MSelect
magclassdata

magclassdata
fulldim

Reconstructs full dimensionality of MAgPIE objects
getNames

Get dataset names
complete_magpie

complete_magpie
getYears

Get years
magpie-class

Class "magpie" ~~~
magclass-package

Data Class and Tools for Handling Spatial-Temporal Data
getComment

getComment
hasSets

Has Sets
head.magpie

head/tail
ncells

Count elements
magpply

magpply
mbind

mbind
new.magpie

new.magpie
ndim

Count sub-dimensions
getRegions

Get regions
dimSums

Summation over dimensions
replace_non_finite

Replace Non-Finite Data
getRegionList

Get a list of celluare region-belongings
maxample

maxample
setNames-methods

Get dataset names
unwrap

Unwrap
dimReduce

dimReduce
mcalc

mcalc
print.magpie

print
population_magpie

population_magpie
getSets

Get sets
log-methods

log-method for MAgPIE objects
sizeCheck

sizeCheck
getCoords

Get Coordinates
read.magpie

Read MAgPIE-object from file
read.report

Read file in report format
magpiesort

MAgPIE-Sort
str.magpie

str
lowpass

Lowpass Filter
suppressSpecificWarnings

suppressSpecificWarnings
unitsplit

splits a data.frame or vector of strings with form 'variable (unit)' into a data.frame with variable and unit separated
time_interpolate

time_interpolate
is.temporal

is.temporal, is.spatial
wrap

Wrap
magpie_expand_dim

magpie_expand_dim
isYear

isYear
round-methods

Round-method for MAgPIE objects
setItems

Set Items
rowSums-methods

~~ Methods for Function rowSums and rowMeans ~~
write.report

Write file in report format
where

where
spatRasterToDataset

spatRasterToDataset
show-methods

~~ Method for function show ~~
write.report2

Write file in report format
write.magpie

Write MAgPIE-object to file
as.SpatRasterDataset

as.SpatRasterDataset
as.RasterBrick

as.RasterBrick
as.SpatVector

as.SpatVector
as_tibble.magpie

magpie method for tibble::as_tibble
add_columns

add_columns
as.data.frame-methods

~~ Methods for Function as.data.frame ~~
as.SpatRaster

as.SpatRaster
add_dimension

add_dimension
clean_magpie

MAgPIE-Clean
dimCode

dimCode
collapseDim

Collapse dataset dimensions
copy.magpie

Copy MAgPIE-files
copy.attributes

Copy Attributes
collapseNames

Collapse dataset names
dimExists

dimExists
as.array-methods

~~ Methods for Function as.array ~~
colSums-methods

~~ Methods for Function colSums and colMeans ~~
dimOrder

dimOrder