View source: R/make.bin.pctile.cols.byzone.R
make.bin.pctile.cols.byzone | R Documentation |
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.
make.bin.pctile.cols.byzone(
bg,
zone,
wtsvarname,
keyvarname = "FIPS",
datavarnames = gsub(keyvarname, "", names(bg)),
clean = TRUE,
...
)
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 |
Returns a data.frame with one percentiles field and one bin numbers field for each of the datavarnames
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.