Summary16

  • 2018年7月22日
  • 注册于 2017年7月26日
  • Summary16 可以用我给新手写的 beginr 包,对一个数据框任意两列做线性拟合并把所有拟合数据都提取成一个表格。

    install.packages('beginr')
    df <- data.frame(a = 1:10, b = 1:10 + rnorm(10), c = 1:10 + rnorm(10))
    beginr::lmdf(df)
    ##   x y r.squared adj.r.squared  intercept     slope Std.Error.intercept
    ## 1 a b 0.9630442     0.9584247 -0.7901086 1.1271749           0.4843895
    ## 2 a c 0.8568806     0.8389907 -0.3427519 1.0425054           0.9346580
    ## 3 b a 0.9630442     0.9584247  0.8783157 0.8543876           0.3749251
    ## 4 b c 0.8157952     0.7927696  0.6004724 0.8856059           0.9426967
    ## 5 c a 0.8568806     0.8389907  1.0688792 0.8219436           0.7466774
    ## 6 c b 0.8157952     0.7927696  0.4432909 0.9211717           0.9729768
    ##   Std.Error.slope t.intercept   t.slope Pr.intercept     Pr.slope
    ## 1      0.07806644  -1.6311430 14.438661   0.14150586 5.177385e-07
    ## 2      0.15063377  -0.3667137  6.920795   0.72334232 1.219459e-04
    ## 3      0.05917360   2.3426432 14.438661   0.04722045 5.177385e-07
    ## 4      0.14878374   0.6369730  5.952303   0.54193651 3.410966e-04
    ## 5      0.11876434   1.4315142  6.920795   0.19016727 1.219459e-04
    ## 6      0.15475888   0.4556027  5.952303   0.66078732 3.410966e-04