Hi I have the following dataframe (with 20 additional columns):
F1<-data.frame(Days=1:40, J1=32:71, J5=42:81, J36=90:129)
I would like to calculate linear regression equations for each of the columns when plotted against the independent variable "Days." I would then like to create vectors from the resulting co-efficients and R-values and add these as rows to my original dataframe.
This code is close (it works when you reverse "." and "Days") but it doesn't seem to work the way I have it. I also don't know the way to create a vector containing the r-values. Thanks for your help.
F1.Bare<-lm(.~ Days, data=F1)
vector1<-coefficients(F1.Bare)
F1.Bare<-rbind(F1, vector1)