2. Encode the outcome
You could dive right in and fit a regression model. E.g. if you focus on the O blood group variant rs8176719:
# Useful function to give us a nice result
broom::tidy(
# This is the actual regression
glm( status ~ rs8176719, family = "binomial", data = abo_data )
)
But you'll probably find this fails with a message about the values.
Of course! For logistic regression, the values should be or , whereas in our data they are strings.
To fix this let's encode as a number instead. We'll map cases to and controls to . A simple way is to convert status to a factor:
There are lots of ways to do this but here's a fairly readable one:
abo_data = (
abo_data
%>% mutate(
status = factor( status, levels = c( "CONTROL", "CASE" ))
)
)
(Another way to do this is to replace status with a new variable equal to or .)
You should now be able to run the above regression and get some results.