瀏覽代碼

allows multiple id-columns

-id1, -id2 work, id1:id2 does not (yet)
pull/10/head
David 7 年之前
父節點
當前提交
259b44fcfa
共有 2 個檔案被更改,包括 3 行新增1 行删除
  1. +2
    -0
      R/animate_tidyr.R
  2. +1
    -1
      R/tidyr_helpers.R

+ 2
- 0
R/animate_tidyr.R 查看文件

@@ -38,6 +38,8 @@ animate_gather <- function(w, key, value, ..., export = "gif", detailed = TRUE)
# ids <- ""
# what happens if ids := -year or ids := x:y

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


+ 1
- 1
R/tidyr_helpers.R 查看文件

@@ -178,7 +178,7 @@ process_long <- function(x, ids, key, value, ...) {
key_values <- x %>% pull(key) %>% unique()

type_dict <- c(rep("id", length(ids)), rep("key", length(key)), rep("value", length(value)))
names(type_dict) <- c(rep(ids, length(ids)), rep(key, length(key)), rep(value, length(value)))
names(type_dict) <- c(ids, key, value)

x_dict <- 1:nc
names(x_dict) <- xn

Loading…
取消
儲存