Closed shea-parkes closed 10 years ago
Hi there,
The labels you provided doesn't fit into a gts
object; instead it's a hts
object.
So please try to use this
bnames1 <- c("VICMelb", "VICGeel", "NSWSynd", "NSWWoll")
bts1 <- matrix(ts(rnorm(160)), ncol = 4)
colnames(bts1) <- bnames1
x1 <- hts(bts1, characters = c(3, 4))
plot(x1)
I was trying for a minimal-reproducible example. Given that a gts
object can have multiple hierarchies, I reasoned that it would be able to have a single hierarchy. Was I incorrect?
I came upon this because I writing code to build up to a multiple-hierarchy problem, so I started with a single hierarchy in gts
and hit some friction in places such as the plotting example above.
Upon reflection, I see why gnames
would take only a character vector of length 1 in the example above (there is only one group), but I still feel the plot labeling is not behaving as I would have anticipated. Is the bottom graph not meant to be the "Bottom" time-series? What happens if G1
shared node names in the second level of its hierarchy?
I've added some patches to the package and the new code will work for your example now
bnames1 <- c("VICMelb", "VICGeel",
"NSWSynd", "NSWWoll")
bts1 <- matrix(ts(rnorm(160)), ncol = 4)
colnames(bts1) <- bnames1
x1 <- gts(bts1)
x1$groups
plot(x1)
Thanks
Here is a slightly altered example from the help docs:
From there, we can see in the graph that the third level isn't titled
Bottom
, and the series there all begin withG1/...
instead ofBottom/...
orG1/VIC/...
andG1/NSW/...
. I don't imagine that was what was intended (but I could be wrong).Additionally, it doesn't appear I can rename the
Bottom
level; thegnames
argument togts()
in this case only accepts a character vector of length 1 and applies that to the middle level. Is this intended?