#define your vectors, for cbind statement datawOBA= cbind(PA,AB,HR,x1B,x2B,x3B,SF,BB,IBB,HBP) wOBAsample=c() ALLHR=c() ALLAB=c() ALLPA=c() ALLx1B=c() ALLx2B=c() ALLx3B=c() ALLBB=c() ALLIBB=c() ALLHBP=c() ALLSF=c() ALLwOBA=c() ALLoWAR=c() for(i in 1:1000){ bootstrapsample=sample(1:nrow(data),size=630,replace=T) databootstrap=data[bootstrapsample,] totals=colSums(databootstrap) PAproj=totals[1] ABproj=totals[2] HRproj=totals[3] x1Bproj=totals[4] x2Bproj=totals[5] x3Bproj=totals[6] SFproj=totals[7] BBproj=totals[8] IBBproj=totals[9] HBPproj=totals[10] wOBAproj= (0.688* totals[8]+ 0.719* totals[10]+ 0.883* totals[4]+ 1.261* totals[5]+ 1.602* totals[6]+ 2.078* totals[3])/ (totals[2]+ totals[8]+ totals[7]+ totals[10] - totals[9]) ALLwOBA[i]=wOBAproj WARproj= (((wOBAproj- 0.313)/1.261)*totals[1] +-2.4 -12.5 + 0.5 + 20/600*totals[1])/10 ALLPA[i]=PAproj ALLAB[i]=ABproj ALLHR[i]=HRproj ALLx1B[i]=x1Bproj ALLx2B[i]=x2Bproj ALLx3B[i]=x3Bproj ALLBB[i]=BBproj ALLSF[i]=SFproj ALLIBB[i]=IBBproj ALLHBP[i]=HBPproj ALLoWAR[i]=WARproj} cbind(PA[x],AB[x],HR[x],x1B[x],x2B[x],x3B[x],BB[x],IBB[x],SF[x], HBP[x], wOBA[x], oWAR[x]) #define x