Package: magclass 7.5.0

Jan Philipp Dietrich

magclass: Data Class and Tools for Handling Spatial-Temporal Data

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

Authors:Jan Philipp Dietrich [aut, cre], Benjamin Leon Bodirsky [aut], Markus Bonsch [aut], Florian Humpenoeder [aut], Stephen Bi [aut], Kristine Karstens [aut], Debbora Leip [aut], Pascal Sauer [aut], Lavinia Baumstark [ctb], Christoph Bertram [ctb], Anastasis Giannousakis [ctb], David Klein [ctb], Ina Neher [ctb], Michaja Pehl [ctb], Anselm Schultes [ctb], Miodrag Stevanovic [ctb], Xiaoxi Wang [ctb], Felicitas Beier [ctb], Mika Pflüger [ctb], Oliver Richters [ctb], Patrick Rein [aut]

magclass_7.5.0.tar.gz
magclass_7.5.0.zip(r-4.7)magclass_7.5.0.zip(r-4.6)magclass_7.5.0.zip(r-4.5)
magclass_7.5.0.tgz(r-4.6-any)magclass_7.5.0.tgz(r-4.5-any)
magclass_7.5.0.tar.gz(r-4.7-any)magclass_7.5.0.tar.gz(r-4.6-any)
magclass_7.5.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
magclass/json (API)

# Install 'magclass' in R:
install.packages('magclass', repos = c('https://pik-piam.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/pik-piam/magclass/issues

Datasets:

On CRAN:

Conda:

data-structuresspatial-temporal

11.51 score 5 stars 58 packages 602 scripts 819 downloads 100 exports 3 dependencies

Last updated from:c263b54483. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK256
source / vignettesOK294
linux-release-x86_64OK261
macos-release-arm64OK155
macos-oldrel-arm64OK186
windows-develOK172
windows-releaseOK151
windows-oldrelOK164
wasm-releaseOK178

Exports:add_columnsadd_dimensionaddDimas.arrayas.data.frameas.magpieas.RasterBrickas.SpatRasteras.SpatRasterDatasetas.SpatVectorclean_magpiecollapseDimcollapseNamescolMeanscolSumscommonYearscomplete_magpieconvergencecopy.attributescopy.attributes<-copy.magpiedimCodedimExistsdimOrderdimReducedimSumsextendfulldimgetCellsgetCells<-getCommentgetComment<-getCoordsgetCoords<-getCPRgetDimgetItemsgetItems<-getNamesgetNames<-getRegionListgetRegionList<-getRegionsgetRegions<-getSetsgetSets<-getYearsgetYears<-guessResolutionhasCoordshasSetsifelseis.magpieis.spatialis.temporalisYearlogblowpassmagpie_expandmagpiesortmagpplymatchDimmaxamplembindmcalcmplotmselectmselect<-ncellsndatandimnew.magpienregionsnyearsOpspmaxpminread.magpieread.reportreplace_non_finiterowMeansrowSumssameDimssetCellssetCommentsetItemssetNamessetYearsshowspatRasterToDatasetsuppressSpecificWarningstime_interpolateunitjoinunitsplitunwrapwherewrapwrite.magpiewrite.reportwrite.report2

Dependencies:abinddata.tablerlang

Concept behind magclass
magclass vs other data-classes | dataclass: matrix | dataclass: array | dataclass: dataframe | dataclass: magclass | Why use magclass for your work?

Last update: 2025-12-09
Started: 2017-06-20

magclass 6
Testing | (soon to be) deprecated functions | New feature: extended sub-dimension support | New magclass subsetting variant | Generalized handling of spatial raster data | One-stop-shop-function getItems | Internal code modifications

Last update: 2025-12-09
Started: 2021-08-31

MAGPIE Class Tutorial
Generate a magpie object | Accessing magpie objects | General properties | Subsets | Data transformations / calculations

Last update: 2025-12-09
Started: 2017-06-12

MAGPIE Class Object Expansion
Auto expansion v1 vs v2 | Set matching | Idential set elements, different set names | Different set element, identical set names

Last update: 2022-03-18
Started: 2019-09-27

Readme and manuals

Help Manual

Help pageTopics
Data Class and Tools for Handling Spatial-Temporal Datamagclass-package magclass
add_columnsadd_columns
add_dimensionadd_dimension
addDimaddDim
aperm method for magpie objectsaperm.magpie
magpie method for tibble::as_tibbleas_tibble.magpie
~~ Methods for Function as.array ~~as.array,ANY-method as.array,magpie-method as.array-methods
~~ Methods for Function as.data.frame ~~as.data.frame as.data.frame,ANY-method as.data.frame,magpie-method as.data.frame-methods
as.RasterBrickas.RasterBrick
as.SpatRasteras.SpatRaster
as.SpatRasterDatasetas.SpatRasterDataset
as.SpatVectoras.SpatVector
cbind method for MAgPIE objectscbind.magpie
MAgPIE-Cleanclean_magpie
Collapse dataset dimensionscollapseDim
Collapse dataset namescollapseNames
~~ Methods for Function colSums and colMeans ~~colMeans,ANY-method colMeans,magpie-method colMeans-methods colSums,ANY-method colSums,magpie-method colSums-methods
commonYearscommonYears
complete_magpiecomplete_magpie
convergenceconvergence
Copy Attributescopy.attributes copy.attributes<-
Copy MAgPIE-filescopy.magpie
dimCodedimCode
dimExistsdimExists
dimOrderdimOrder
dimReducedimReduce
Summation over dimensionsdimSums
escapeRegexescapeRegex
extendextend
Reconstructs full dimensionality of MAgPIE objectsfulldim
Get CellsgetCells getCells<- setCells
getCommentgetComment getComment<- setComment
Get CoordinatesgetCoords getCoords<-
Get cells per regiongetCPR
getDimgetDim
Get ItemsgetItems getItems<-
Get dataset namesgetNames getNames<-
Get a list of celluare region-belongingsgetRegionList getRegionList<-
Get regionsgetRegions getRegions<-
Get setsgetSets getSets<-
Get yearsgetYears getYears<- setYears
guessResolutionguessResolution
Has CoordinateshasCoords
Has SetshasSets
head/tailhead.magpie tail.magpie
is.temporal, is.spatialis.spatial is.temporal
isYearisYear
log-method for MAgPIE objectslog,magpie-method log-methods logb,magpie-method logb-methods
Lowpass Filterlowpass
magclassdatamagclassdata
magpie_expandmagpie_expand
magpie_expand_dimmagpie_expand_dim
Class "magpie" ~~~as.magpie as.magpie,array-method as.magpie,data.frame-method as.magpie,logical-method as.magpie,lpj-method as.magpie,LPJmLData-method as.magpie,magpie-method as.magpie,NULL-method as.magpie,numeric-method as.magpie,quitte-method as.magpie,RasterBrick-method as.magpie,RasterLayer-method as.magpie,RasterStack-method as.magpie,SpatRaster-method as.magpie,SpatVector-method as.magpie,tbl_df-method as.magpie-methods ifelse,magpie-method is.finite,magpie-method is.infinite,magpie-method is.magpie is.na,magpie-method is.nan,magpie-method magpie-class Ops,magpie,magpie-method Ops,magpie,numeric-method Ops,numeric,magpie-method [,magpie,ANY,ANY-method [,magpie-method [<-,magpie,ANY,ANY-method [<-,magpie-method
MAgPIE-Sortmagpiesort
magpplymagpply
Match dimensions of a magpie object to those of a reference objectmatchDim
maxamplemaxample
mbindmbind
mcalcmcalc mcalc<-
mplotmplot
MSelectmselect mselect<-
Count elementsncells ndata nregions nyears
Count sub-dimensionsndim
new.magpienew.magpie
pmin/pmaxmagpie-pmin-pmax pmax pmax,ANY-method pmax,magpie-method pmin pmin,ANY-method pmin,magpie-method
population_magpiepopulation_magpie
printprint.magpie
Read MAgPIE-object from fileread.magpie
Read file in report formatread.report
Replace Non-Finite Datareplace_non_finite
Round-method for MAgPIE objectsround,magpie-method round-methods
~~ Methods for Function rowSums and rowMeans ~~rowMeans,ANY-method rowMeans,magpie-method rowMeans-methods rowSums,ANY-method rowSums,magpie-method rowSums-methods
sameDimssameDims
Set ItemssetItems
Get dataset namessetNames setNames,magpie-method setNames,NULL-method setNames-methods
~~ Method for function 'show' ~~show show,ANY-method show,magpie-method show-methods
sizeChecksizeCheck
spatRasterToDatasetspatRasterToDataset
strstr.magpie
suppressSpecificWarningssuppressSpecificWarnings
time_interpolatetime_interpolate
joins a data.frame or vector of strings with variable and unit separated into a data.frame with variable and unit joined as 'variable (unit)'. Use magclass::unitsplit to split them againunitjoin
splits a data.frame or vector of strings with form 'variable (unit)' into a data.frame with variable and unit separatedunitsplit
Unwrapunwrap
wherewhere
Wrapwrap
Write MAgPIE-object to filewrite.magpie
Write file in report formatwrite.report
Write file in report formatwrite.report2