title: Creating decision tree
body: <p>I have a csv file (298 rows and 24 columns) and i want to create a decision tree to predict the column "salary". I have downloaded tree package and added via library function.</p>
  
  <p>But when i try to create the decision tree:</p>
  
  <pre><code>model&lt;-tree(salary~.,data)
  </code></pre>
  
  <p>I get the error like below:</p>
  
  <pre><code> *Error in tree(salary ~ ., data) : 
    factor predictors must have at most 32 levels* 
  </code></pre>
  
  <p>What is wrong with that? Data is as follows:</p>
  
  <pre><code>      Name bat hit homeruns runs
  1   Alan Ashby 315  81        7   24
  2  Alvin Davis 479 130       18   66
  3 Andre Dawson 496 141       20   65
  ...
  team position putout assists errors
  1 Hou.        C    632      43     10
  2 Sea.       1B    880      82     14
  3 Mon.       RF    200      11      3
  salary league87 team87
  1    475        N   Hou.
  2    480        A   Sea.
  3    500        N   Chi.
  </code></pre>
  
  <p>And its the value of str(data):</p>
  
  <p>'data.frame':   263 obs. of  24 variables:
   $ Name                     : Factor w/ 263 levels "Al Newman","Alan Ashby",..: 2 7 8 10 6 1 13 11 9 3 ...</p>
  
  <p>$ bat                      : int  315 479 496 321 594 185 298 323 401 574 ...</p>
  
  <p>$ hit                      : int  81 130 141 87 169 37 73 81 92 159 ...</p>
  
  <p>$ homeruns                 : int  7 18 20 10 4 1 0 6 17 21 ...</p>
  
  <p>$ runs                     : int  24 66 65 39 74 23 24 26 49 107 ...</p>
  
  <p>$ runs.batted              : int  38 72 78 42 51 8 24 32 66 75 ...</p>
  
  <p>$ walks                    : int  39 76 37 30 35 21 7 8 65 59 ...</p>
  
  <p>$ years.in.major.leagues   : int  14 3 11 2 11 2 3 2 13 10 ...</p>
  
  <p>$ bats.during.career       : int  3449 1624 5628 396 4408 214 509 341 5206 4631 ...</p>
  
  <p>$ hits.during.career       : int  835 457 1575 101 1133 42 108 86 1332 1300 ...</p>
  
  <p>$ homeruns.during.career   : int  69 63 225 12 19 1 0 6 253 90 ...</p>
  
  <p>$ runs.during.career       : int  321 224 828 48 501 30 41 32 784 702 ...</p>
  
  <p>$ runs.batted.during.career: int  414 266 838 46 336 9 37 34 890 504 ...</p>
  
  <p>$ walks.during.career      : int  375 263 354 33 194 24 12 8 866 488 ...</p>
  
  <p>$ league                   : Factor w/ 2 levels "A","N": 2 1 2 2 1 2 1 2 1 1 ...</p>
  
  <p>$ division                 : Factor w/ 2 levels "E","W": 2 2 1 1 2 1 2 2 1 1 ...</p>
  
  <p>$ team                     : Factor w/ 24 levels "Atl.","Bal.",..: 9 21 14 14 16 14 10 1 7 
  8 ...</p>
  
  <p>$ position                 : Factor w/ 23 levels "1B","1O","23",..: 10 1 20 1 22 4 22 22 13 22 ...</p>
  
  <p>$ putout                   : int  632 880 200 805 282 76 121 143 0 238 ...</p>
  
  <p>$ assists                  : int  43 82 11 40 421 127 283 290 0 445 ...</p>
  
  <p>$ errors                   : int  10 14 3 4 25 7 9 19 0 22 ...</p>
  
  <p>$ salary                   : num  475 480 500 91.5 750 ...</p>
  
  <p>$ league87                 : Factor w/ 2 levels "A","N": 2 1 2 2 1 1 1 2 1 1 ...</p>
  
  <p>$ team87                   : Factor w/ 24 levels "Atl.","Bal.",..: 9 21 5 14 16 13 10 1 7 8 ...</p>