Get name of related avg, pctile, or ratio variable name
Source:R/fixcolnames2related.R
fixcolnames2related.Rd
Given names_d, e.g., returns names_d_ratio_to_state_avg
Usage
fixcolnames2related(
namesnow,
relatedtype = c("usavg", "stateavg", "uspctile", "statepctile", "usratio",
"stateratio")
)
Arguments
- namesnow
vector of one or more basic Envt or Demog indicator variable names found in c(names_e, names_d, names_d_subgroups)
One of "usavg", "stateavg", "uspctile", "statepctile", "usratio", "stateratio" (but not any of the other values among unique(map_headernames$vartype) since those give ambiguous answers).
Details
Given basic variable name(s) like "pctlowinc" or names_e, see what the related variable names are for storing the US or State percentiles, averages, or ratios to averages of the given variables.
Only works for variable names among these:
c(names_e, names_d, names_d_subgroups)
Examples
names_d
#> [1] "Demog.Index" "Demog.Index.Supp" "pctlowinc" "pctlingiso"
#> [5] "pctunemployed" "pctlths" "pctunder5" "pctover64"
#> [9] "pctmin"
#> attr(,"ejam_package_version")
#> Version
#> "2.32.0"
#> attr(,"ejscreen_version")
#> EJScreenVersion
#> "2.32"
#> attr(,"ejscreen_releasedate")
#> EJScreenReleaseDate
#> "2024-08-12"
#> attr(,"acs_releasedate")
#> ACSReleaseDate
#> "2023-12-07"
#> attr(,"acs_version")
#> ACSVersion
#> "2018-2022"
#> attr(,"census_version")
#> CensusVersion
#> "2020"
#> attr(,"date_saved_in_package")
#> [1] "2025-02-05"
fixcolnames2related(names_d, 'stateratio')
#> Error in fixcolnames2related(names_d, "stateratio"): could not find function "fixcolnames2related"
names_d_ratio_to_state_avg
#> [1] "ratio.to.state.avg.Demog.Index" "ratio.to.state.avg.Demog.Index.Supp"
#> [3] "ratio.to.state.avg.pctlowinc" "ratio.to.state.avg.pctlingiso"
#> [5] "ratio.to.state.avg.pctunemployed" "ratio.to.state.avg.pctlths"
#> [7] "ratio.to.state.avg.pctunder5" "ratio.to.state.avg.pctover64"
#> [9] "ratio.to.state.avg.pctmin"
#> attr(,"ejam_package_version")
#> Version
#> "2.32.0"
#> attr(,"ejscreen_version")
#> EJScreenVersion
#> "2.32"
#> attr(,"ejscreen_releasedate")
#> EJScreenReleaseDate
#> "2024-08-12"
#> attr(,"acs_releasedate")
#> ACSReleaseDate
#> "2023-12-07"
#> attr(,"acs_version")
#> ACSVersion
#> "2018-2022"
#> attr(,"census_version")
#> CensusVersion
#> "2020"
#> attr(,"date_saved_in_package")
#> [1] "2025-02-05"
fixcolnames2related(names_e, "stateavg")
#> Error in fixcolnames2related(names_e, "stateavg"): could not find function "fixcolnames2related"
fixcolnames2related(names_e, "usvag")
#> Error in fixcolnames2related(names_e, "usvag"): could not find function "fixcolnames2related"
paste0("avg.", names_e)
#> [1] "avg.pm" "avg.o3" "avg.no2"
#> [4] "avg.dpm" "avg.rsei" "avg.traffic.score"
#> [7] "avg.pctpre1960" "avg.proximity.npl" "avg.proximity.rmp"
#> [10] "avg.proximity.tsdf" "avg.ust" "avg.proximity.npdes"
#> [13] "avg.drinking"
fixcolnames2related(names_e, "usratio")
#> Error in fixcolnames2related(names_e, "usratio"): could not find function "fixcolnames2related"
# names_ej # does not work with this as input
# fixcolnames2related(names_ej, "uspctile") # does not return names_ej_pctile