I'm dealing with text files and vectors.
I have a space separated text file with the following format:
id1 AA 44 AG 20 GG 36
id2 CC 30 CT 22 TT 48
id3 CT 60 CC 30 TT 10
...
And I need a code that loops through each line and put the id in a variable and the rest of the values in a vector. Example of a vector corresponding to the first line:
x <- id1
y <- c(AA=40,AG=20,GG=36)
Edit: I need to use HWChisq function from HardyWeinberg package to exclude SNPs that have p-value < 0.001. Function requires named vector of counts for each allele.