cedricbatailler / JSmediation

Compare 95f48bf ... +5 ... e15394a

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -15,7 +15,7 @@
Loading
15 15
#' @param M_B an unquoted numeric variable in the data frame which will be used
16 16
#'   as the mediatior variable value for the "b" independent variable condition.
17 17
#'   
18 -
#' @section Data formatting: To be consistant with other \code{mdt_*} family
18 +
#' @section Data formatting: To be consistent with other \code{mdt_*} family
19 19
#'   functions, \code{mdt_within} takes a long-format data frame as \code{data}
20 20
#'   argument. With this kind of format, each sampled unit has two rows, one for
21 21
#'   the first within-participant condition and one for the second
@@ -26,7 +26,7 @@
Loading
26 26
#'   Because such formatting is not the most common among social scientists
27 27
#'   interested in within-participant mediation, \pkg{JSmediation} contains the
28 28
#'   \code{\link{mdt_within_wide}} function which handles wide-formatted data
29 -
#'   input (but is syntax-inconsistant with other \code{mdt_*} family
29 +
#'   input (but is syntax-inconsistent with other \code{mdt_*} family
30 30
#'   functions).
31 31
#'
32 32
#' @section Variable coding: Models underlying within-participant mediation use

@@ -109,17 +109,17 @@
Loading
109 109
  IV_cond <- data %>% dplyr::pull( !! IV_var ) %>% unique()
110 110
111 111
  M_cond_1_name <-
112 -
    glue::glue("{M_name}_mean_{IV_cond[[1]]}")
112 +
    as.character(glue::glue("{M_name}_mean_{IV_cond[[1]]}"))
113 113
  M_cond_2_name <-
114 -
    glue::glue("{M_name}_mean_{IV_cond[[2]]}")
114 +
    as.character(glue::glue("{M_name}_mean_{IV_cond[[2]]}"))
115 115
116 116
  M_mean_name <-
117 -
    glue::glue("{M_name}_mean")
117 +
    as.character(glue::glue("{M_name}_mean"))
118 118
119 119
  DV_cond_1_name <-
120 -
    glue::glue("{DV_name}_mean_{IV_cond[[1]]}")
120 +
    as.character(glue::glue("{DV_name}_mean_{IV_cond[[1]]}"))
121 121
  DV_cond_2_name <-
122 -
    glue::glue("{DV_name}_mean_{IV_cond[[2]]}")
122 +
    as.character(glue::glue("{DV_name}_mean_{IV_cond[[2]]}"))
123 123
124 124
  # wrangling
125 125
  wrangling_formula <-
@@ -146,20 +146,20 @@
Loading
146 146
  # else, set B - A.
147 147
  if(DV_A_sup_B == default_coding) {
148 148
    DV_diff_name <-
149 -
      glue::glue("DV_{IV_cond[[1]]}_{IV_cond[[2]]}")
149 +
      as.character(glue::glue("DV_{IV_cond[[1]]}_{IV_cond[[2]]}"))
150 150
    M_diff_name <-
151 -
      glue::glue("IV_{IV_cond[[1]]}_{IV_cond[[2]]}")
151 +
      as.character(glue::glue("IV_{IV_cond[[1]]}_{IV_cond[[2]]}"))
152 152
153 153
    data_long <-
154 154
      data_long %>%
155 155
      dplyr::mutate( !! sym(DV_diff_name) := !! sym(DV_cond_1_name) - !! sym(DV_cond_2_name),
156 156
                     !! sym(M_diff_name)  := !! sym(M_cond_1_name)  - !! sym(M_cond_2_name))
157 157
  } else {
158 158
    DV_diff_name <-
159 -
      glue::glue("DV_{IV_cond[[2]]}_{IV_cond[[1]]}")
159 +
      as.character(glue::glue("DV_{IV_cond[[2]]}_{IV_cond[[1]]}"))
160 160
161 161
    M_diff_name <-
162 -
      glue::glue("M_{IV_cond[[2]]}_{IV_cond[[1]]}")
162 +
      as.character(glue::glue("M_{IV_cond[[2]]}_{IV_cond[[1]]}"))
163 163
164 164
    data_long <-
165 165
      data_long %>%

@@ -13,7 +13,7 @@
Loading
13 13
  NULL
14 14
}
15 15
16 -
# Method for moderated_mediation class. Checks wether IV, Mediator, or
16 +
# Method for moderated_mediation class. Checks whether IV, Mediator, or
17 17
# Moderator is either a contrast-coded or a centered variable. Throws a
18 18
# message if it is not the case.
19 19
check_variables.moderated_mediation <- function(model) {

@@ -40,17 +40,20 @@
Loading
40 40
  pvalue <-
41 41
    summary_statistics$p.value[1]
42 42
  
43 -
  glue::glue("t({df}) = {t}, p {p}",
44 -
             p = ifelse(
45 -
               pvalue < .001,
46 -
               "< .001",
47 -
               sub(
48 -
                 ".",
49 -
                 "= ",
50 -
                 format(round(summary_statistics$p.value, 3),
51 -
                        nsmall = 3
43 +
  as.character(
44 +
    glue::glue("t({df}) = {t}, p {p}",
45 +
               p = ifelse(
46 +
                 pvalue < .001,
47 +
                 "< .001",
48 +
                 sub(
49 +
                   ".",
50 +
                   "= ",
51 +
                   format(round(summary_statistics$p.value, 3),
52 +
                          nsmall = 3
53 +
                   )
52 54
                 )
53 55
               )
54 -
             ))
56 +
    )
57 +
  )
55 58
  
56 59
}

Learn more Showing 12 files with coverage changes found.

Changes in R/mdt_within.R
-2
Loading file...
Changes in R/mdt_simple.R
-1
Loading file...
Changes in R/mdt_moderated.R
-1
Loading file...
Changes in R/create_path.R
-1
Loading file...
Changes in R/mdt_within_wide.R
-3
Loading file...
Changes in R/mdt_simple_index.R
-1
Loading file...
Changes in R/mdt_within_index.R
-1
Loading file...
Changes in R/mediation_model_class.R
-2
Loading file...
Changes in R/check_variables.R
-2
Loading file...
Changes in R/indirect_effect_class.R
-3
Loading file...
Changes in R/indirect_effect-methods.R
-1
Loading file...
Changes in R/mdt_moderated_index.R
-4
Loading file...
Files Coverage
R -0.25% 94.52%
Project Totals (19 files) 94.52%
Loading