Explorar el Código

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

pull/18/merge
Garrick Aden-Buie hace 7 años
padre
commit
4592186af7
Se han modificado 2 ficheros con 5 adiciones y 10 borrados
  1. +2
    -1
      DESCRIPTION
  2. +3
    -9
      R/animate_tidyr.R

+ 2
- 1
DESCRIPTION Ver fichero

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

+ 3
- 9
R/animate_tidyr.R Ver fichero

@@ -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",

Cargando…
Cancelar
Guardar