Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gperrett committed Dec 15, 2023
1 parent fa0cd6c commit d1b7c25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: plotBart
Type: Package
Title: Diagnostic and Plotting Functions to Supplement 'bartCause'
Version: 0.1.25
Version: 0.1.27
Authors@R: c(
person("Joseph", "Marlo", email = "[email protected]", role = c("aut", "cre")),
person("George", "Perrett", email = "[email protected]", role = c("aut"))
Expand Down
9 changes: 6 additions & 3 deletions R/plot_balance.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@

plot_balance <- function(.data, treatment, confounders, compare = c('means', 'variance', 'covariance'), estimand = c('ATE', 'ATT', 'ATC'), limit_continuous = NULL, limit_catagorical = NULL){
if(missing(treatment)) stop('enter a string indicating the name of the treatment variable')
if(!is.integer(limit_continuous)&!is.null(limit_continuous)) stop('limit_continuous must be an integer')
if(!is.integer(limit_catagorical)&!is.null(limit_catagorical)) stop('limit_catagorical must be an integer')
if('factor' %in% sapply(.data[, confounders], class)) stop('factor variables must be converted to numeric or logical indicator variables')
if('character' %in% sapply(.data[, confounders], class)) stop('factor variables must be converted to numeric or logical indicator variables')

if(!is.null(limit_continuous)){
if(limit_continuous != round(limit_continuous)) stop('limit_continuous must be a whole number that can be converted to numeric')
}
if(!is.null(limit_catagorical)){
if(limit_catagorical != round(limit_catagorical)&!is.null(limit_catagorical)) stop('limit_catagorical must be a whole number that can be converted to numeric')
}
if (length(table(.data[[treatment]])) != 2) stop("treatment must be binary")
.data[[treatment]] <- coerce_to_logical_(.data[[treatment]])

Expand Down

0 comments on commit d1b7c25

Please sign in to comment.