title: Object of type 'closure' is not subsettable error when trying to run simulation
body: <p>I am trying to run a simulation of a probability matrix with 5 states. </p>
  
  <pre><code>N&lt;-10 #for 10 simulations
  state&lt;-simulat(P,N,1) #P is a matrix defined earlier in my code
  
  for(i in 1:N)
      {
          if (state[i]=='0')
          {
              time[i]&lt;-rexp(1,Mu)
          }
          if (state[i]=='1' || state[i]=='2' || state[i]=='3')
          {
              time[i]&lt;-rexp(1,(Mu+Lamda))
          }
          if (state[i]=='4')
          {
              time[i]&lt;-rexp(1,Lamda)
          }
      }
  Error in time[i] &lt;- rexp(1, Mu) : 
    object of type 'closure' is not subsettable
  </code></pre>
  
  <p>Is this an issue with formatting or am I defining my state[i] incorrectly? I have tried switching my [] to (), but then it gives me an error that says it could not find function 'state', even though I had just defined it above. Any help is appreciated.</p>