Skip to contents

Compute observed residuals for each variables in data and appends these newly created variables to the original dataset.

Usage

append_observed_residuals(data, na.rm = TRUE)

Arguments

data

A data.frame or tibble

na.rm

logical (defaults to TRUE)

Value

A numeric matrix of correlations among variable residuals.

Examples

  # Use the SCWB data example
  data(SCWB)
  append_observed_residuals(SCWB[, 1:20])
#> # A tibble: 453 × 40
#>    cwbcloserel cwbrespect cwbtrust cwbmutuality cwbbeneficence cwbintegrity
#>          <dbl>      <dbl>    <dbl>        <dbl>          <dbl>        <dbl>
#>  1           3          3        3            3              2            3
#>  2           4          4        5            5              5            3
#>  3           2          2        1            2              3            2
#>  4           5          4        4            4              4            5
#>  5           4          4        6            6              3            4
#>  6           4          1        2            5              1            5
#>  7           6          5        5            5              5            6
#>  8           2          2        2            3              4            4
#>  9           3          2        2            3              4            3
#> 10           3          2        2            2              5            5
#> # ℹ 443 more rows
#> # ℹ 34 more variables: cwbcompetence <dbl>, cwbvision <dbl>,
#> #   cwbrelgrowth <dbl>, cwbfairness <dbl>, cwbsustenance <dbl>,
#> #   cwbachieve <dbl>, cwbsatisf <dbl>, cwbvalue <dbl>, cwbbelonging <dbl>,
#> #   cwbwelcome <dbl>, cwbpurpose <dbl>, cwbcontrib <dbl>, cwbinterconn <dbl>,
#> #   cwbsynergy <dbl>, resid_cwbcloserel <dbl>, resid_cwbrespect <dbl>,
#> #   resid_cwbtrust <dbl>, resid_cwbmutuality <dbl>, …