showClass("magpie")
pop <- maxample("pop")
# returning PAO and PAS for 2025
pop["PA", 2025, , pmatch = "left"]
# returning CPA for 2025
pop["PA", 2025, , pmatch = "right"]
# returning CPA PAO and PAS for 2025
pop["PA", 2025, , pmatch = TRUE]
# returning PAS and 2025
pop["PAS", 2025, ]
# return all entries for year 2025
pop[2025, dim = 2]
# returning everything but values for PAS or values for 2025
pop["PAS", 2025, , invert = TRUE]
# accessing subdimension via set name
a <- maxample("animal")
a[list(country = "NLD", y = "53p25"), , list(species = c("rabbit", "dog"))]
# please note that the list elements act as filter. For instance, the
# following example will not contain any dogs as the data set does
# not contain any dogs which are black.
a[list(country = "NLD", y = "53p25"), , list(species = c("rabbit", "dog"), color = "black")]
# it is also possible to extract given combinations of subdimensions
# via a data-frame
df <- data.frame(getItems(a, 3, split = TRUE, full = TRUE))[c(1, 3, 4), ][3:2]
getItems(a[df], 3)
# Unknown dimensions to be added in output!
df$blub <- paste0("bl", 1:dim(df)[1])
getItems(a[df], 3)
Run the code above in your browser using DataLab