Skip to content

Commit

Permalink
allows multiple id-columns
Browse files Browse the repository at this point in the history
-id1, -id2 work, id1:id2 does not (yet)
  • Loading branch information
DavZim committed Aug 23, 2018
1 parent 64bfc54 commit 259b44f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/animate_tidyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "-"]

Expand Down
2 changes: 1 addition & 1 deletion R/tidyr_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 259b44f

Please sign in to comment.