title: Forecasting timeseries with tslm in R
body: <p>I'm still new to R and am facing a problem i can't seem to resolve.</p>
  
  <p>I would like to forecast my time series data. 
  I have this year's daily numbers: y, and last year's daily number which I want to use as a predictor.
  The numbers show week cycles. I tried this code. (Fake numbers for clarity)</p>
  
  <pre><code>x = rnorm(60,0,1)
  y = rnorm(60,0 ,1) + 2*cos(2*pi*1:60/7) + 10*x
  new_x = rnorm(10,0,1) 
  
  y &lt;- ts(y,frequency = 7)
  fit &lt;- tslm(y ~ trend + season + x)
  
  fcast = forecast.lm(fit, h = 10, newdata = new_x)
  </code></pre>
  
  <p>I get the error message :</p>
  
  <pre><code>    Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : 
        variable lengths differ (found for 'x')
      In addition: Warning message:
  'newdata' had 10 rows but variables found have 60 rows
  </code></pre>
  
  <p>Any hints on what I did wrong? </p>