title: Change names of stacked raster data in plot rasterVis package in R
body: <p>I have the next code:</p>
  
  <pre><code>list_data &lt;- list.files(pattern="*NDVI",full.names=T)
  </code></pre>
  
  <p>stack my data using: </p>
  
  <pre><code>data &lt;- stack(list_data)
  </code></pre>
  
  <p>and the names of layers is:</p>
  
  <pre><code>&gt; names(data) 
   [1] "Max_NDVI_2000" "Max_NDVI_2001" "Max_NDVI_2002"
   [4] "Max_NDVI_2003" "Max_NDVI_2004" "Max_NDVI_2005"
   [7] "Max_NDVI_2006" "Max_NDVI_2007" "Max_NDVI_2008"
  [10] "Max_NDVI_2009" "Max_NDVI_2010" "Max_NDVI_2011"
  </code></pre>
  
  <p><strong>then, i need change names of layer: 2000, 2001, ......, 2011,</strong>, I'm using</p>
  
  <pre><code>names(data) &lt;- 2000:2011
  </code></pre>
  
  <p>but I get X2000, X2001 ...</p>
  
  <pre><code>&gt; names(data)
   [1] "X2000" "X2001" "X2002"
   [4] "X2003" "X2004" "X2005"
   [7] "X2006" "X2007" "X2008"
  [10] "X2009" "X2010" "X2011"
  </code></pre>
  
  <p>however, if I use a characters the output is correct:</p>
  
  <pre><code>&gt; names(data) &lt;- month.abb 
  &gt; names(data)
   [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug"
   [9] "Sep" "Oct" "Nov" "Dec"
  </code></pre>
  
  <p>How the class of month.abb is character then, then I change  </p>
  
  <pre><code>names(data) &lt;- as.character(2000:2011)
  </code></pre>
  
  <p>but the output does not change.</p>
  
  <p>**then, how I can change the names of layer? **.</p>
  
  <p>PD: I need change the name for plot my data using the <strong><a href="https://oscarperpinan.github.io/rastervis/" rel="nofollow">rasterVis</a></strong> package (levelplot function)</p>