Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions R/powell_wiley.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
#' @import dplyr
#' @importFrom MASS ginv
#' @importFrom psych alpha principal
#' @importFrom stats complete.cases cor cov2cor loadings median promax quantile sd
#' @importFrom stats complete.cases cor cov2cor loadings median promax sd
#' @importFrom stringr str_trim
#' @importFrom tidycensus get_acs
#' @importFrom tidyr pivot_longer separate
#' @importFrom Hmisc wtd.quantile
#' @export
#'
#' @seealso \code{\link[tidycensus]{get_acs}} for additional arguments for geographic referent selection (i.e., \code{state} and \code{county}).
Expand Down Expand Up @@ -346,9 +347,10 @@ powell_wiley <- function(geo = 'tract',
NDIQuint <- ndi_data_NDI %>%
dplyr::mutate(
NDIQuint = cut(
NDI * log(TotalPop),
breaks = stats::quantile(
NDI * log(TotalPop),
NDI,
breaks = Hmisc::wtd.quantile(
NDI,
weights = TotalPop,
probs = c(0, 0.2, 0.4, 0.6, 0.8, 1),
na.rm = TRUE
),
Expand Down
Loading