Parcourir la source

factor out need for tidyr

pull/21/head
Garrick Aden-Buie il y a 6 ans
Parent
révision
1b1b8307ce
3 fichiers modifiés avec 8 ajouts et 9 suppressions
  1. +0
    -1
      DESCRIPTION
  2. +7
    -6
      R/regex.R
  3. +1
    -2
      R/utils.R

+ 0
- 1
DESCRIPTION Voir le fichier

rstudioapi, rstudioapi,
shiny (>= 0.13), shiny (>= 0.13),
stringi, stringi,
tidyr,
utils utils
Suggests: Suggests:
jsonlite, jsonlite,

+ 7
- 6
R/regex.R Voir le fichier

.data$start <= !!inserts$start[j] & .data$end >= !!inserts$end[j]) .data$start <= !!inserts$start[j] & .data$end >= !!inserts$end[j])
inserts[j, 'pad'] <- inserts$pad[j] + nrow(overlap) inserts[j, 'pad'] <- inserts$pad[j] + nrow(overlap)
} }
inserts <- inserts %>%
tidyr::gather(type, loc, start:end) %>%
inserts <- dplyr::bind_rows(
inserts %>% select(-.data$end, dplyr::everything(), loc = .data$start) %>% mutate(type = "start"),
inserts %>% select(-.data$start, dplyr::everything(), loc = .data$end) %>% mutate(type = "end")
) %>%
filter(!is.na(.data$loc)) %>% filter(!is.na(.data$loc)) %>%
dplyr::arrange(loc, class, dplyr::desc(type)) %>% dplyr::arrange(loc, class, dplyr::desc(type)) %>%
mutate( mutate(
inserts <- if (max(inserts$pass) == 1) { inserts <- if (max(inserts$pass) == 1) {
collapse_span_inserts(inserts) collapse_span_inserts(inserts)
} else { } else {
inserts %>%
tidyr::nest(spans = -.data$pass) %>%
mutate(spans = purrr::map(.data$spans, collapse_span_inserts)) %>%
tidyr::unnest(.data$spans) %>%
split(inserts, inserts$pass) %>%
purrr::map(collapse_span_inserts) %>%
dplyr::bind_rows() %>%
group_by(.data$loc, .data$type) %>% group_by(.data$loc, .data$type) %>%
summarize(insert = paste(.data$insert, collapse = "")) %>% summarize(insert = paste(.data$insert, collapse = "")) %>%
dplyr::ungroup() dplyr::ungroup()

+ 1
- 2
R/utils.R Voir le fichier

gsub("\\\\", "\\\\\\\\", x) gsub("\\\\", "\\\\\\\\", x)
} }


# avoid CRAN note for tidyr::gather in wrap_results
utils::globalVariables(c("end", "loc", "start", "type"))
utils::globalVariables(c("loc", "type"))

Chargement…
Annuler
Enregistrer