While this code was working before, it is no longer working now - and comes up with this error (below the code). Any tips for troubleshooting it?
# regression
my_lms <- sapply(1:ncol(df), function(x) lm(df[,x] ~ df[,1])) # run linear regression models across all vars in df and store in my_lms
tmp <- sapply(my_lms, coef)
ERROR: Error in object$coefficients : $ operator is invalid for atomic vectors
is a screenshot, not an R object that can be reproduced. Lacking a reprex. See the FAQ, I made up some data and guessed that the first sapply worked and the second was not.