title: R: rename hierarchy levels of an hts object
body: <p>How can I rename the levels an hts (hierarchical and grouped time series) object created with the hts <a href="http://cran.r-project.org/web/packages/hts/hts.pdf" rel="nofollow">package</a>?</p>
  
  <p>Example:</p>
  
  <pre><code>abc &lt;- ts(5 + matrix(sort(rnorm(200)), ncol = 4, nrow = 100))
  x &lt;- hts(abc, c(1,1,2,2))
  </code></pre>
  
  <p>The hts object <code>x</code> has 3 levels (incl. total) hierachically assigned by <code>c(1,1,2,2)</code>.
  When using <code>plot(x, levels=2)</code> I just get the plot for level 1 (2nd in hierarchy) with lines named A and B.</p>
  
  <p>How can I rename those levels with custom names?</p>