library(magclass)
t <- c(1995, 2005, 2015)
s <- c('AFR', 'CPA')
A <- dimSums(maxample('pop')[s,t,'A2'], 3)
B <- dimSums(maxample('pop')[s,t[-2],'B1'], 3)
> A
An object of class "magpie"
, , 1
t
i y1995 y2005 y2015
AFR 552.6664 696.44 889.18
CPA 1280.6350 1429.53 1518.46
> B
An object of class "magpie"
, , 1
t
i y1995 y2015
AFR 552.6664 932.04
CPA 1280.6350 1499.74
Now, running magpie_expand on B with A as ref:
magpie_expand(B, A)
An object of class "magpie"
, , 1
t.t1
i y1995.y1995 y1995.y2015 y2005.y1995 y2005.y2015 y2015.y1995 y2015.y2015
AFR 552.6664 932.04 552.6664 932.04 552.6664 932.04
CPA 1280.6350 1499.74 1280.6350 1499.74 1280.6350 1499.74
That is not how I understand the function, I would have expected something with the dimension of A
Digging into the code, it seems that magclass:::magpie_expand_dim(B, A, dim = 2) shows this error, so I guess the problem is somewhere here: Before this line, the object are defined as follows:
Now, running magpie_expand on
B
withA
as ref:That is not how I understand the function, I would have expected something with the dimension of
A
Digging into the code, it seems that
magclass:::magpie_expand_dim(B, A, dim = 2)
shows this error, so I guess the problem is somewhere here: Before this line, the object are defined as follows:So it cannot match anything. Unclear whether that is intended.