title: Make two vectors of different lengths equal in length
body: <p>I have two vectors of different lenghts. How can I start both series so their ends concide.  </p>
  
  <pre><code>x&lt;-c(1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6)
  y&lt;-c(1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4)
  </code></pre>
  
  <p>I do it with the code below but I guess there must be a more elegant way</p>
  
  <pre><code>x&lt;-x[((length(x)-length(y))+1):length(x)]
  
  x
   [1]  3  4  5  6  7  8  9 10 11 12  1  2  3  4  5  6
  y
   [1]  1  2  3  4  5  6  7  8  9 10 11 12  1  2  3  4
  </code></pre>