Skip to content

Commit

Permalink
set_vars_type: fixed type replacement with multiple occurences
Browse files Browse the repository at this point in the history
  • Loading branch information
bguiastr committed Jun 20, 2017
1 parent 5f5e0c3 commit 6c80311
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/vars_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ set_vars_type <- function(xpdb, problem = NULL, ..., auto_factor = TRUE, quiet)
if (length(single_type) > 0) index$type[index$type %in% single_type] <- 'na'

# Replace the matching values
index$type[match(args$col, index$col)] <- args$type
x$index[[1]] <- index
for (repl in 1:nrow(args)) {
index$type[index$col == args$col[repl]] <- args$type[repl]
}
x$index[[1]] <- index

# Change categorical covariates to factor
if (any(args$type == 'catcov') && auto_factor) {
Expand Down

0 comments on commit 6c80311

Please sign in to comment.