make.bin.pctile.cols.byzone: May be obsolete-not used -was Percentile and bin number...

View source: R/make.bin.pctile.cols.byzone.R

make.bin.pctile.cols.byzoneR Documentation

May be obsolete-not used -was Percentile and bin number fields, by zone, such as percentiles within each State

Description

May be obsolete- just uses make.bin.pctile.cols() which now has a zone parameter. Get weighted percentiles and bin numbers, by subset of rows (zone), for each column of data. This can be used to calculate population-weighted percentiles within each State, for national data on Census block groups, for example.

Usage

make.bin.pctile.cols.byzone(
  bg,
  zone,
  wtsvarname,
  keyvarname = "FIPS",
  datavarnames = gsub(keyvarname, "", names(bg)),
  clean = TRUE,
  ...
)

Arguments

bg

Data.frame of data field(s), weights (optional), and a unique ID (e.g., FIPS), one row per place if geographic data is used.

zone

Optional vector specifying subsets of rows (e.g. State name) within which percentiles are calculated

wtsvarname

Name of field in bg that has optional weights for weighted percentiles. Default is unweighted.

keyvarname

Name of field in bg that has unique ID per row (per place). Default is "FIPS"

datavarnames

Vector of names of fields in bg that have numeric data for which percentiles are calculated.

clean

Does not use clean.fips() if FALSE, which helps if the countiesall or other list is not yet updated, for example and lacks some new FIPS code

...

Other parameters passed to make.bin.pctile.cols() such as cutpoints and labels

Value

Returns a data.frame with one percentiles field and one bin numbers field for each of the datavarnames


ejanalysis/ejanalysis documentation built on April 2, 2024, 10:12 a.m.