open-innovations / jrf-insight

JRF North England Insight Finder
https://open-innovations.github.io/jrf-insight/
MIT License
1 stars 0 forks source link

Cannot run imd.R script #92

Closed gilesdring closed 1 year ago

gilesdring commented 1 year ago

When I try to run the IMD R script I get the following issue.

Error in `tidyr::pivot_longer()` at dplyr/R/mutate.R:146:2:
! Arguments in `...` must be used.
✖ Problematic argument:
• ..1 = "variable"
ℹ Did you misspell an argument name?
Backtrace:
     ▆
  1. ├─dplyr::select(...)
  2. ├─dplyr::mutate(...) at dplyr/R/select.R:54:2
  3. ├─dplyr::mutate(...) at dplyr/R/mutate.R:146:2
  4. ├─dplyr::mutate(...) at dplyr/R/mutate.R:146:2
  5. ├─dplyr::mutate(...) at dplyr/R/mutate.R:146:2
  6. └─tidyr::pivot_longer(readr::read_csv(imd_file), -(1:4), "variable") at dplyr/R/mutate.R:146:2
  7.   └─rlang (local) `<fn>`() at dplyr/R/mutate.R:146:2
  8.     └─rlang:::check_dots(env, error, action, call) at rlang/R/dots-ellipsis.R:62:2
  9.       └─rlang:::action_dots(...) at rlang/R/dots-ellipsis.R:75:2
 10.         ├─base (local) try_dots(...) at rlang/R/dots-ellipsis.R:260:2
 11.         └─rlang (local) action(...) at rlang/R/dots-ellipsis.R:260:2
Execution halted
ERROR: failed to reproduce 'R/dvc.yaml:imd': failed to run: Rscript R/imd.R, exited with 1

Any idea @ChristianSpence?

It seems that the problematic line is the central of these...

imd_all_lsoa <- readr::read_csv(imd_file) |>
  tidyr::pivot_longer(-(1:4), 'variable') |>
  dplyr::mutate(domain = substr(variable, 1, regexpr('Score|Rank|Decile', variable) - 2)) |>
ChristianSpence commented 1 year ago

There was a missing argument name, so being called in the wrong parameter. Fixed and pushed.