pachadotdev / gravity
Showing 1 of 1 files from the diff.

@@ -170,18 +170,20 @@
Loading
170 170
    )
171 171
172 172
  # Substracting the means for the other independent variables -----------------
173 -
  d2 <- d %>%
174 -
    select(!!sym(code_origin), !!sym(code_destination), !!!syms(additional_regressors)) %>%
175 -
    gather(!!sym("key"), !!sym("value"), -!!sym(code_origin), -!!sym(code_destination)) %>%
176 -
    mutate(key = paste0(!!sym("key"), "_ddm")) %>%
177 -
    group_by(!!sym(code_origin), !!sym("key"), .add = FALSE) %>%
178 -
    mutate(ddm = !!sym("value") - mean(!!sym("value"), na.rm = TRUE)) %>%
179 -
    group_by(!!sym(code_destination), !!sym("key"), .add = FALSE) %>%
180 -
    mutate(ddm = !!sym("ddm") - mean(!!sym("value"), na.rm = TRUE)) %>%
181 -
    ungroup() %>%
182 -
    mutate(value = !!sym("ddm") + mean(!!sym("value"), na.rm = TRUE)) %>%
183 -
    select(!!!syms(c(code_origin, code_destination, "key", "value"))) %>%
184 -
    spread(!!sym("key"), !!sym("value"))
173 +
  if (!is.null(additional_regressors)) {
174 +
    d2 <- d %>%
175 +
      select(!!sym(code_origin), !!sym(code_destination), !!!syms(additional_regressors)) %>%
176 +
      gather(!!sym("key"), !!sym("value"), -!!sym(code_origin), -!!sym(code_destination)) %>%
177 +
      mutate(key = paste0(!!sym("key"), "_ddm")) %>%
178 +
      group_by(!!sym(code_origin), !!sym("key"), .add = FALSE) %>%
179 +
      mutate(ddm = !!sym("value") - mean(!!sym("value"), na.rm = TRUE)) %>%
180 +
      group_by(!!sym(code_destination), !!sym("key"), .add = FALSE) %>%
181 +
      mutate(ddm = !!sym("ddm") - mean(!!sym("value"), na.rm = TRUE)) %>%
182 +
      ungroup() %>%
183 +
      mutate(value = !!sym("ddm") + mean(!!sym("value"), na.rm = TRUE)) %>%
184 +
      select(!!!syms(c(code_origin, code_destination, "key", "value"))) %>%
185 +
      spread(!!sym("key"), !!sym("value"))
186 +
  }
185 187
186 188
  # Model ----------------------------------------------------------------------
187 189
  if (!is.null(additional_regressors)) {
Files Coverage
R 84.63%
Project Totals (17 files) 84.63%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
    patch:
10
      default:
11
        target: auto
12
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading