title: Error in rep: invalide 'times' argument
body: <p>When I try to run the following code for 10000 iterations I get the following error.Error in rep(G1[, 2], G1[, 3]) : invalid 'times' argument. So don't know how to change the code to fix that error. Basically just want to create time series for the generator performance using the equation for Time to fail and time to repair for 8736 hours in the year so that I have the time series in hours when the generator is operating in when is not. The starting conditions is that the generator is operating on the first hour. For sure there is a more elegant solution for simulating this I'm just not able to find it. Any comment or help will be appreciated.</p>
  
  <pre><code>MTTF&lt;-2940 # MEDIUM TIME TO FAIL(hours)
  MTTR&lt;-60 # MEDIUM TIME TO REPAIR (hours)
  TTF&lt;--MTTF*log(runif(100))# equation for Time to fail 
  TTR&lt;--MTTR*log(runif(100))# equation for Time to repair
  mix&lt;-rep(0,length(TTF)+length(TTR))
  sw&lt;-rep(0,length(TTF)+length(TTR))
  for(i in 1:length(TTF)){
  mix[2*i-1]&lt;-TTF[i]
  sw[2*i-1]&lt;-1
  mix[2*i]&lt;-TTR[i]
  }
  cmix&lt;-cumsum(mix)
  ccmix&lt;-cbind(cmix[1:which(cmix&gt;8736)],sw[1:which(cmix&gt;8736)])
  ccmix[dim(ccmix)[1],1]&lt;-8736
  
  
  G1&lt;-round(ccmix)
  # transform binary values
  G1[G1 == 1] &lt;- 12 # is the capacity of the generator
  
  G1 &lt;- cbind(G1, c(G1[1,1], diff(G1[,1])))
  a1 &lt;- rep(G1[,2], G1[,3]) ## GENERATING 8736 Values
  </code></pre>
  
  <p>So the desired output are 8736 values of 12 when is ON and 0 when is OFF</p>