title: Categorize numeric variable into group/ bins/ breaks
body: <p>I am trying to categorize a numeric variable (age) into groups defined by intervals so it will not be continuous. I have this code:</p>
  <pre><code>data$agegrp(data$age &gt;= 40 &amp; data$age &lt;= 49) &lt;- 3
  data$agegrp(data$age &gt;= 30 &amp; data$age &lt;= 39) &lt;- 2
  data$agegrp(data$age &gt;= 20 &amp; data$age &lt;= 29) &lt;- 1
  </code></pre>
  <p>the above code is not working under survival package. It's giving me:</p>
  <pre><code>invalid function in complex assignment
  </code></pre>
  <p>Can you point me where the error is? <code>data</code> is the dataframe I am using.</p>