turn glm plot into function and experiment with magrittr