Skip to content

Commit

Permalink
allow formulas containing syntactically invalid variable names (i.e. …
Browse files Browse the repository at this point in the history
…ones needing backticks)
  • Loading branch information
mwmclean committed Sep 8, 2017
1 parent 39ae5f4 commit d65078e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/estimationdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ EstimationData <- function(formula = NULL,
weight.label <- Labels(weights)
}
unfiltered.weights <- weights
# Selecting the relevant variables from the data frame (unless imputation is being used).
variable.names <- AllVariablesNames(formula)
## Selecting the relevant variables from the data frame (unless imputation is being used).
## Remove backticks if present
variable.names <- sub("^[`]([[:print:]]*)[`]$", "\\1", AllVariablesNames(formula), perl = TRUE)
labels <- Labels(data[, variable.names], show.name = TRUE)
# Removing cases with entirely missing data
some.data <- !apply(is.na(data[, variable.names, drop = FALSE]), 1, all)
Expand Down

0 comments on commit d65078e

Please sign in to comment.