Skip to content

Commit

Permalink
fixed bug in getCatVarDummyNames
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelvy committed Mar 18, 2021
1 parent e454fb7 commit 58cb38a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
## Bugs

- Fixed bug where model with single variable would error due to a matrix being converted to a vector in the `standardDraws()` function
- Fixed bug in `getCatVarDummyNames()` - previously used string matching, which can accidentally match with other similarly-named variables.

# logitr 0.1.1

Expand Down
6 changes: 3 additions & 3 deletions R/modelInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ addIntPars <- function(data, parNames, intNames, parTypes) {
}

getCatVarDummyNames <- function(data, discPar) {
allVars <- names(data)
matches <- which(grepl(paste0(discPar, "_"), allVars))
return(allVars[matches][-1])
levels <- as.vector(as.matrix(unique(data[discPar])))
varNames <- sort(paste(discPar, levels, sep = "_"))
return(varNames[-1])
}

getParSetup <- function(parNames, priceName, randPars, randPrice) {
Expand Down

0 comments on commit 58cb38a

Please sign in to comment.