Skip to content

Commit

Permalink
Fix Issue #92
Browse files Browse the repository at this point in the history
  • Loading branch information
MeganFantes committed Aug 16, 2019
1 parent 1cb65f3 commit 286c556
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions R/utilities-histogram.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,26 +427,27 @@ determineMechanismByRange <- function(varType, rng, bins, nBins, granularity) {
#' vector for logical, numeric, and integer variables.

determineBins <- function(varType, rng, bins, n, nBins, impute, granularity, object) {
if (!is.null(bins)) {
# if the user passed in bins, then the passed bins are the histogram bins
# check entered bins for errors. If there are not errors, entered bins will be assigned as histogram bins.
# if there are errors, an error message will be returned to the user.
if (varType == 'logical') {
# first check if the variable is logical, because the built-in functions should
# determine the bins of a logical variable, regardless of if the user entered bins
# or not.
return(determineLogicalBins(impute, object))
} else if (!is.null(bins)) {
# if the user passed in bins, then the passed bins are the histogram bins.
# check entered bins for errors. If there are not errors, entered bins
# will be assigned as histogram bins. if there are errors, an error
# message will be returned to the user.
errorCheckBins(varType, rng, bins)
return(bins)
} else {
# if we have reached this condition, then the data is not categorical,
# because we only call this function if the mechanism is not the stability
# mechanism and the bins are not passed in by the user. If the variable is
# categorical and the bins are not passed in, then the mechanism is the
# stability mechanism. So we only need to check logical, numeric, and integer.
if (varType == 'logical') {
return(determineLogicalBins(impute, object))
} else {
# if we have reached this conditional statement, then the variable type can
# only be numeric or integer, and the user must have entered the range and
# either the number of bins or the granularity.
return(determineNumericIntegerBins(rng, n, nBins, granularity))
}
# stability mechanism. So we only need to check numeric and integer,
# and the user must have entered the range and either the number of bins
# or the granularity.
return(determineNumericIntegerBins(rng, n, nBins, granularity))
}
}

Expand Down

0 comments on commit 286c556

Please sign in to comment.