tidy_lm_add_r_squared: 'tidy_lm_add_r_squared'

Description Usage Arguments Value Author(s) Examples

View source: R/tidy_lm_add_r_squared.R

Description

add r.squared and adj.r.squared to tidy table of lm results.

Usage

1

Arguments

tidy_df

a tidy table of lm results

n

the number of participants analyzed. Using nrow(data), where data is the dataframe used in lm is a good option.

Value

column of r.squared and adj.r.squared added a tidy table of a lm

Author(s)

Ekarin Eric Pongpipat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
packages <- c("broom", "broomExtra", "dplyr", "modelr", "tibble")
xfun::pkg_attach2(packages, message = F)

data <- tibble(
  a = scale(sample.int(100), scale = F),
  b = scale(sample.int(100), scale = F),
  c = b^2,
  d = scale(sample.int(100), scale = F)
)

lm(a ~ b, data) %>%
  tidy() %>%
  tidy_lm_add_r_squared(., n = nrow(data))

epongpipat/broomExtra documentation built on Aug. 9, 2019, 12:10 p.m.