calculate linear regression between every two columns in a data frame. in: a dataframes. out: a dataframe showing the linear regression.

lmdf(data, simply = FALSE, intercept = TRUE)

Arguments

data

a dataframe

simply

logical

intercept

logical

Value

another dataframe

Examples

df <- data.frame(a = 1:10, b = 1:10 + rnorm(10), c = 1:10 + rnorm(10)) lmdf(df)
#> x y r.squared adj.r.squared intercept slope Std.Error.intercept #> 1 a b 0.8074691 0.7834027 0.3499883 0.9136207 0.9786753 #> 2 a c 0.9284243 0.9194774 -0.3259025 1.0596284 0.6454289 #> 3 b a 0.8074691 0.7834027 0.7495963 0.8838121 0.9333436 #> 4 b c 0.6434225 0.5988503 0.8387251 0.8676118 1.3968462 #> 5 c a 0.9284243 0.9194774 0.6792151 0.8761792 0.5456824 #> 6 c b 0.6434225 0.5988503 1.2945693 0.7416018 1.2383324 #> Std.Error.slope t.intercept t.slope Pr.intercept Pr.slope #> 1 0.15772780 0.3576143 5.792389 0.7298832 4.086953e-04 #> 2 0.10402028 -0.5049395 10.186748 0.6272144 7.391770e-06 #> 3 0.15258164 0.8031300 5.792389 0.4451034 4.086953e-04 #> 4 0.22835438 0.6004420 3.799410 0.5648297 5.241068e-03 #> 5 0.08601166 1.2447078 10.186748 0.2484655 7.391770e-06 #> 6 0.19518869 1.0454135 3.799410 0.3263883 5.241068e-03