I'm trying to build a series of linear models for a set of Standard Curves.
Currently this code is working to produce my desired outputs (Intercept and Slope of each Linear Model):
slopes <- STANDARDS %>% group_by(plate, col, row, conc_ug_mL) %>% do(
    #model = lm(value ~ variable, data = .),
    intercept = coef(lm(value ~ variable, data = .))[1],
    slope = coef(lm(value ~ variable, data = .))[2])
But I had to comment the model line out and call lm twice. I would really like to make it like this:
slopes2 <- STANDARDS %>% group_by(plate, col, row, conc_ug_mL) %>% do(
    model = lm(value ~ variable, data = .),
    intercept = coef(.$model)[1],
    slope = coef(.$model)[2])
The second block of code does not raise an error but return NULL for both Intercept and Slope. I think my problem is not understanding the reference structure within dplyr::do.
But am just learning dplyr and not sure of how to do this. Thanks.
 
    