title: Error in x[j] : invalid subscript type 'list' while using subset in R
body: <p>I have a problem while I'm trying to subset my dataframe. Here is the code that I'm using to import data file and sub-setting;</p>
  
  <pre><code>fiber_val&lt;-read.csv(file.choose(), header=TRUE, dec=",", check.names=FALSE,stringsAsFactors=FALSE)
  y&lt;-14
  z&lt;-16
  fiber_val[, y:z] &lt;- sapply(fiber_val[, y:z], as.numeric)
  
  fiber_val$sg&lt;-(fiber_val$airdryweight/1.077)/fiber_val$waterweight
  
  fiber_val&lt;-subset(fiber_val, select = c(id,sample,standtreedisk,density,sg))
  </code></pre>
  
  <p>after running the last line, it yells at me</p>
  
  <pre><code>Error in x[j] : invalid subscript type 'list'
  </code></pre>
  
  <p>and here's part of data set that I'm using;</p>
  
  <pre><code>id  stand   tree    disk    species region  standtreedisk   nirblock    sample  barktopith  pithtobark  length  sections    ringssection    airdryweight    waterweight density
  1   160 7   10  131 6   160x7x10    749 16907   4   2   52  5   2   0.6489  1.3245  0.48992
  2   160 7   10  131 6   160x7x10    749 16905   2   4   52  5   3   0.6062  1.2206  0.49664
  3   160 7   12  131 6   160x7x12    750 16915   2   3   43  4   2   0.6438  1.3279  0.48483
  4   160 7   13  131 6   160x7x13    750 16919   2   2   30  3   3   0.5816  1.4101  0.41245
  5   161 17  12  131 6   161x17x12   760 17166   4   2   50  5   1   0.5702  1.3952  0.40869
  6   161 17  12  131 6   161x17x12   760 17167   5   1   50  5   1   0.5454  1.3307  0.40986
  7   161 17  12  131 6   161x17x12   760 17163   1   5   50  5   1   0.6947  1.5702  0.44243
  8   161 17  13  131 6   161x17x13   760 17170   3   1   32  3   2   0.4357  1.2244  0.35585
  9   26  9   7   131 4   26x9x7  140 3883    8   1   82  8   2   0.4595  1.3503  0.34029
  10  161 17  13  131 6   161x17x13   760 17169   2   2   32  3   1   0.484   1.2843  0.37686
  11  136 50  1   131 6   136x50x1    579 12482   9   1   96  9   2   0.5392      
  12  137 54  5   131 4   137x54x5    586 12636   4   4   73  7   1   0.4692      
  13  137 54  5   131 4   137x54x5    586 12638   6   2   73  7   2   0.4555      
  14  137 54  6   131 4   137x54x6    586 12640   1   6   65  6   4   0.6449      
  15  137 54  1   131 4   137x54x1    585 12606   5   5   90  9   1   0.7035      
  16  137 54  1   131 4   137x54x1    585 12610   9   1   90  9   2   0.4963      
  17  137 54  1   131 4   137x54x1    585 12609   8   2   90  9   2   0.5193      
  18  137 54  1   131 4   137x54x1    585 12603   2   8   90  9   3   0.6427      
  19  137 54  6   131 4   137x54x6    586 12644   5   2   65  6   1   0.4654      
  20  137 54  4   131 4   137x54x4    585 12632   7   1   76  7   2   0.4974      
  21  137 54  5   131 4   137x54x5    586 12639   7   1   73  7   2           
  22  137 5   3   131 4   137x5x3 582 12557   2   7   82  8   3           
  23  137 74  3   131 4   137x74x3    588 12679   3   5   71  7   2           
  24  137 74  3   131 4   137x74x3    588 12683   7   1   71  7   1           
  25  137 5   3   131 4   137x5x3 582 12562   7   2   82  8   1           
  26  137 74  5   131 4   137x74x5    588 12695   6   1   61  6   2           
  27  138 108 1   131 4   138x108x1   594 12830   6   5   104 10  1           
  28  138 108 1   131 4   138x108x1   594 12831   7   4   104 10  2           
  29  138 108 1   131 4   138x108x1   594 12832   8   3   104 10  2           
  30  138 66  1   131 4   138x66x1    592 12781   5   4   87  8   2           
  </code></pre>
  
  <p>any help would be appreciated :)</p>