Skip to content

Commit

Permalink
better strategy for keeping names off cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gergness committed Jul 29, 2020
1 parent 2bc33c2 commit 1dd4b18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions R/case-variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ caseExpr <- function(..., cases) {
new_cat_type <- list(
value = list(
class = "categorical",
categories = unname(lapply(cases, function(case) {
categories = lapply(cases, function(case) {
case[c("id", "name", "numeric_value", "missing")]
}))
})
)
)
new_cat_ids <- unname(vapply(cases, vget("id"), integer(1)))
new_cat_ids <- vapply(cases, vget("id"), integer(1))
new_cat <- list(column = I(new_cat_ids), type = new_cat_type)

# remove nulls from case expressions (should only be from the else case)
Expand Down
2 changes: 1 addition & 1 deletion R/case-when-variable.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ makeCaseWhenVariable <- function(..., data = NULL, formulas = NULL, name) {
formula_dots <- vapply(dots, function(x) inherits(x, "formula"), logical(1))

args <- list(
data = caseWhenExpr(data = data, formulas = c(formulas, dots[formula_dots])),
data = caseWhenExpr(data = data, formulas = c(formulas, unname(dots[formula_dots]))),
name = name
)
args <- c(args, dots[!formula_dots])
Expand Down

0 comments on commit 1dd4b18

Please sign in to comment.