I have 40 SNPs and want to see the effect each individual SNP has on the age of menopause. To do this I need do a multiple linear regression each of the individual SNPs. I want to avoid typing the same command 40 different times (as in the future I'll be doing this with even more SNPs).
What I want to do is make a list of the SNPs in a csv
file and call this x
:
x <- read.csv("snps.csv")
Then I want to use this list in this command;
fit <- lm(a_menopause ~ "snps" + country, data=mydata)
Where snps
is my list of the SNPs I need to analyse, but needs to be done one SNP at a time. I'd ideally like to print the results to a csv
file.