Pārlūkot izejas kodu

Use tidyselect to let ... in animate_gather() match semantics of tidyr::gather()

pull/18/merge
Garrick Aden-Buie pirms 7 gadiem
vecāks
revīzija
4592186af7
2 mainītis faili ar 5 papildinājumiem un 10 dzēšanām
  1. +2
    -1
      DESCRIPTION
  2. +3
    -9
      R/animate_tidyr.R

+ 2
- 1
DESCRIPTION Parādīt failu

@@ -26,7 +26,8 @@ Imports:
magrittr,
rlang (>= 0.1.2),
scales,
tidyr
tidyr,
tidyselect
Suggests:
knitr,
roxygen2,

+ 3
- 9
R/animate_tidyr.R Parādīt failu

@@ -34,16 +34,10 @@ animate_gather <- function(w, key, value, ..., export = "gif", detailed = TRUE)

# construct the title sequence
wname <- deparse(substitute(w))
ids <- get_quos_names(...)
# ids <- ""
# what happens if ids := -year or ids := x:y
tidyr_selection <- get_quos_names(...)
ids <- setdiff(colnames(w), tidyselect::vars_select(colnames(w), ...))

# the case that ... contains two -arguments. i.e., -year, -region
ids <- ids[2, ]
ids <- ids[!ids %in% c(key, value)]
ids <- ids[ids != "-"]

id_string <- paste0(", ", paste(sprintf("-%s", ids), collapse = ", "))
id_string <- paste0(", ", paste(sprintf("%s", tidyr_selection), collapse = ", "))

sequence <- c(
current_state = "wide",

Notiek ielāde…
Atcelt
Saglabāt