NVAR 6957423
RATE 1
MAC 963.605
MAF 0.228126
SING 0
MONO 0
TITV 1.99326
TITV_S NA
DP NA
QUAL NA
PASS 1
FILTER|PASS 1
PASS_S 0
I have several files (N=414) with the format above. In R, I would like to read all files, transpose, and rbind or concatenate values. My files are named age_wg2_ind1.vstats, ranging from 1 to 414 (after ind[i].vstats). So far, I've tried this:
txtfiles = list.files(pattern="*.vstats")
for (i in 1:length(txtfiles)){
tmp = read.table(txtfiles[i],sep="\t")
ttmp<-t(tmp[i])
colnames(ttmp)<-ttmp[1,];ttmp2<-ttmp[2:nrow(ttmp),]
}
Error in ttmp[2:nrow(ttmp), ] : subscript out of bounds
1) Will the list files command really begin with individual #1 and end with #414? 2) Not sure where to put [i] to retain second row of each file.
Thanks!