This is the command I am running, aim is to go over 22 chromosome files.

```
for(i in 1:22) {
id <- i
dat <- read.table("~/path/to/files/chromosome",id[i],".QC.het" header=T) # Read in the EUR.het file, specify it has header
m <- mean(dat$F) # Calculate the mean  
s <- sd(dat$F) # Calculate the SD
valid <- subset(dat, F <= m+3*s & F >= m-3*s) # Get any samples with F coefficient within 3 SD of the population mean
write.table(valid[,c(1,2)], "~/path/to/files/chromosome",id[i],".valid.sample", quote=F, row.names=F) # print FID and IID for valid samples
}

```

I am getting the following error.

```
Error: unexpected symbol in:
"  id <- i
dat <- read.table("~/analysis_files/ukb_imp_chr",id[i],".QC.het" header"
Execution halted

```

Any suggestions?