title: variable lengths differ in R
body: <p>I am getting the error above when trying to use the cv.lm fucntion. Please see my code</p>
  
  <pre><code>sample&lt;-read.csv("UU2_1_lung_cancer.csv",header=TRUE,sep=",",na.string="NA")
    sample1&lt;-sample[2:2000,3:131]
    samplex&lt;-sample[2:50,3:131]
    y&lt;-as.numeric(sample1[1,]) 
    y&lt;-as.numeric(sample1[2:50,2]) 
    x1&lt;-as.numeric(sample1[2:50,3])
    x2&lt;-as.numeric(sample1[2:50,4])
    x11&lt;-x1[!is.na(y)]
    x12&lt;-x2[!is.na(y)]
    y&lt;-y[!is.na(y)]
    fit1 &lt;- lm(y ~ x11 + x12, data=sample)
    fit1
    x3&lt;-as.numeric(sample1[2:50,5])
    x4&lt;-as.numeric(sample1[2:50,6])
    x13&lt;-x3[!is.na(y)]
    x14&lt;-x4[!is.na(y)]
    fit2 &lt;- lm(y ~ x11 + x12 + x13 + x14, data=sample)
    anova(fit1,fit2)
    install.packages("DAAG")
    library("DAAG")
    cv.lm(df=samplex, fit1, m=10) # 3 fold cross-validation
  </code></pre>
  
  <p>Any insight will be appreciated. </p>
  
  <pre><code>Example of data
  ID       peak height     LCA001 LCA002  LCA003
  N001786 32391.111   0.397   0.229   -0.281
  N005356 32341.473   0.397   -0.655  -1.301
  N002416 32215.474   -0.703  -0.214  -0.901
  GS239   31949.777   0.354   0.118   0.272
  N016343 31698.853   0.226   0.04    -0.006
  N003255 31604.978   0.024    NA -0.534
  N004358 31356.597   -0.252  -0.022  -0.407
  N000122 31168.09    -0.487  -0.533  -0.134
  GS10564 31106.103   -0.156  -0.141  -1.17
  GS17987 31043.876    NA     0.253   0.553
  N003674 30876.207   0.109   0.093   0.07
  </code></pre>
  
  <p>Please see the example of the data above</p>