Data Class and Tools for Handling Spatial-Temporal Data

R package magclass, version 6.13.2

CRAN status DOI R build status codecov r-universe

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


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

options(repos = c(CRAN = "@CRAN@", pik = ""))

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:


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



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


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:, R package version 6.13.2, <URL:>.

A BibTeX entry for LaTeX users is

 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 = {},