Performing a linear model in R of a single response with a single predictor from a large dataframe and repeat for each column
问题 It might not be very clear from the title but what I wish to do is: I have a dataframe df with, say, 200 columns and the first 80 columns are response variables (y1, y2, y3, ...) and the rest of 120 are predictors (x1, x2, x3, ...). I wish to compute a linear model for each pair – lm(yi ~ xi, data = df) . Many problems and solutions I have looked through online have a either a fixed response vs many predictors or the other way around, using lapply() and its related functions. Could anyone who