Skip to contents

utility to check if a variable or term is in map_headernames and where

Usage

varin_map_headernames(
  query = "lowinc",
  ignore.case = TRUE,
  exact = FALSE,
  cols_with_names = c("oldname", "apiname", "api_synonym", "acsname", "csvname",
    "ejscreen_csv", "rname", "topic_root_term", "basevarname", "denominator",
    "shortlabel", "longname", "description", "csvlongname", "api_description",
    "acs_description", "varlist")
)

Arguments

query

variable name or fragment (or regular expression) to look for in map_headernames columns, looking within just column names listed in cols_with_names. Or a vector of query terms in which case this returns one column per query term.

ignore.case

optional, like in grepl()

exact

set to TRUE for only exact matches

cols_with_names

optional, colnames of map_headernames to check in

Value

data.frame of info about where query was found and how many hits.

See also

Examples

varin_map_headernames("spanish")
#>                 exactmatch grepmatch.hitcount
#> oldname              FALSE                  4
#> apiname              FALSE                  2
#> api_synonym          FALSE                  0
#> acsname              FALSE                  4
#> csvname              FALSE                  0
#> ejscreen_csv         FALSE                  0
#> rname                FALSE                  4
#> topic_root_term      FALSE                  4
#> basevarname          FALSE                  0
#> denominator          FALSE                  0
#> shortlabel           FALSE                  4
#> longname             FALSE                  4
#> api_description      FALSE                  2
#> acs_description      FALSE                  4
#> varlist              FALSE                  0
#>                                                        example
#> oldname                                              P_SPANISH
#> apiname                                              P_SPANISH
#> api_synonym                                               <NA>
#> acsname                                        PCT_LAN_SPANISH
#> csvname                                                   <NA>
#> ejscreen_csv                                              <NA>
#> rname                                           pctlan_spanish
#> topic_root_term                                 pctlan_spanish
#> basevarname                                               <NA>
#> denominator                                               <NA>
#> shortlabel                              %speak Spanish at home
#> longname        Percent of population speaking Spanish at home
#> api_description Percent of population speaking Spanish at home
#> acs_description                     Pct__Speak_Spanish_at_Home
#> varlist                                                   <NA>
varin_map_headernames("lowinc")
#>                 exactmatch grepmatch.hitcount    example
#> oldname              FALSE                  1  LOWINCOME
#> apiname              FALSE                  0       <NA>
#> api_synonym          FALSE                  1   P_LOWINC
#> acsname               TRUE                  2 PCT_LOWINC
#> csvname              FALSE                  4  LOWINCPCT
#> ejscreen_csv         FALSE                  4  LOWINCPCT
#> rname                 TRUE                  8  pctlowinc
#> topic_root_term      FALSE                  8  pctlowinc
#> basevarname           TRUE                  8  pctlowinc
#> denominator          FALSE                  0       <NA>
#> shortlabel           FALSE                  0       <NA>
#> longname             FALSE                  0       <NA>
#> api_description      FALSE                  0       <NA>
#> acs_description      FALSE                  0       <NA>
#> varlist              FALSE                  0       <NA>
varin_map_headernames("pop")
#>                 exactmatch grepmatch.hitcount
#> oldname              FALSE                  2
#> apiname              FALSE                  2
#> api_synonym          FALSE                  1
#> acsname              FALSE                  1
#> csvname              FALSE                  1
#> ejscreen_csv         FALSE                  1
#> rname                 TRUE                  2
#> topic_root_term      FALSE                  0
#> basevarname           TRUE                  2
#> denominator           TRUE                112
#> shortlabel           FALSE                  6
#> longname             FALSE                 22
#> api_description      FALSE                 12
#> acs_description      FALSE                 27
#> varlist              FALSE                  0
#>                                                                                example
#> oldname                                                                       totalPop
#> apiname                                                                       totalPop
#> api_synonym                                                                   TOTALPOP
#> acsname                                                                       TOTALPOP
#> csvname                                                                      ACSTOTPOP
#> ejscreen_csv                                                                 ACSTOTPOP
#> rname                                                                              pop
#> topic_root_term                                                                   <NA>
#> basevarname                                                                        pop
#> denominator                                                                        pop
#> shortlabel                                                                  Population
#> longname                    Percent of population speaking Other Indo-European at home
#> api_description Percent of population speaking Other and Unspecified languages at home
#> acs_description                                               Pct__Hispanic_Population
#> varlist                                                                           <NA>
varin_map_headernames("POV", ignore.case = T)
#>                 exactmatch grepmatch.hitcount
#> oldname              FALSE                  3
#> apiname              FALSE                  0
#> api_synonym          FALSE                  0
#> acsname              FALSE                  2
#> csvname              FALSE                  1
#> ejscreen_csv         FALSE                  1
#> rname                FALSE                  1
#> topic_root_term      FALSE                  0
#> basevarname          FALSE                  1
#> denominator          FALSE                  1
#> shortlabel           FALSE                  3
#> longname             FALSE                  3
#> api_description      FALSE                  0
#> acs_description      FALSE                  2
#> varlist              FALSE                  0
#>                                                                   example
#> oldname                                                        ACSIPOVBAS
#> apiname                                                              <NA>
#> api_synonym                                                          <NA>
#> acsname                                                       PCT_HH_BPOV
#> csvname                                                        ACSIPOVBAS
#> ejscreen_csv                                                   ACSIPOVBAS
#> rname                                                       povknownratio
#> topic_root_term                                                      <NA>
#> basevarname                                                 povknownratio
#> denominator                                                 povknownratio
#> shortlabel               Population for whom Poverty Status is Determined
#> longname        Count of Population for whom Poverty Status is Determined
#> api_description                                                      <NA>
#> acs_description                       Pct__Households_below_Poverty_Level
#> varlist                                                              <NA>
varin_map_headernames("POV", ignore.case = F)
#>                 exactmatch grepmatch.hitcount     example
#> oldname              FALSE                  3  ACSIPOVBAS
#> apiname              FALSE                  0        <NA>
#> api_synonym          FALSE                  0        <NA>
#> acsname              FALSE                  2 PCT_HH_BPOV
#> csvname              FALSE                  1  ACSIPOVBAS
#> ejscreen_csv         FALSE                  1  ACSIPOVBAS
#> rname                FALSE                  0        <NA>
#> topic_root_term      FALSE                  0        <NA>
#> basevarname          FALSE                  0        <NA>
#> denominator          FALSE                  0        <NA>
#> shortlabel           FALSE                  0        <NA>
#> longname             FALSE                  0        <NA>
#> api_description      FALSE                  0        <NA>
#> acs_description      FALSE                  0        <NA>
#> varlist              FALSE                  0        <NA>

varin_map_headernames( "traffic.score", exact = T)
#>                 exactmatch grepmatch.hitcount       example
#> oldname              FALSE                  0          <NA>
#> apiname              FALSE                  0          <NA>
#> api_synonym          FALSE                  0          <NA>
#> acsname              FALSE                  0          <NA>
#> csvname              FALSE                  0          <NA>
#> ejscreen_csv         FALSE                  0          <NA>
#> rname                FALSE                  1 traffic.score
#> topic_root_term      FALSE                 15 traffic.score
#> basevarname          FALSE                  7 traffic.score
#> denominator          FALSE                  0          <NA>
#> shortlabel           FALSE                  0          <NA>
#> longname             FALSE                  0          <NA>
#> api_description      FALSE                  0          <NA>
#> acs_description      FALSE                  0          <NA>
#> varlist              FALSE                  0          <NA>

varin_map_headernames( "traffic" )
#>                 exactmatch grepmatch.hitcount
#> oldname              FALSE                  9
#> apiname              FALSE                  9
#> api_synonym          FALSE                  0
#> acsname              FALSE                  0
#> csvname              FALSE                  0
#> ejscreen_csv         FALSE                  0
#> rname                FALSE                 15
#> topic_root_term      FALSE                 15
#> basevarname          FALSE                 11
#> denominator          FALSE                  0
#> shortlabel            TRUE                 15
#> longname             FALSE                 15
#> api_description      FALSE                  9
#> acs_description      FALSE                  0
#> varlist              FALSE                  0
#>                                                                             example
#> oldname                                                               RAW_E_TRAFFIC
#> apiname                                                               RAW_E_TRAFFIC
#> api_synonym                                                                    <NA>
#> acsname                                                                        <NA>
#> csvname                                                                        <NA>
#> ejscreen_csv                                                                   <NA>
#> rname                                                                 traffic.score
#> topic_root_term                                                       traffic.score
#> basevarname                                                           traffic.score
#> denominator                                                                    <NA>
#> shortlabel                                                                  Traffic
#> longname        Traffic Proximity and Volume (daily traffic count/distance to road)
#> api_description                                                   Traffic Proximity
#> acs_description                                                                <NA>
#> varlist                                                                        <NA>

t(varinfo("traffic.score", 
  info = c("oldname","apiname", "acsname" ,"csvname", 
  "basevarname", 'shortlabel', 'longname', 'varlist')))
#>             traffic.score                                                        
#> oldname     "RAW_E_TRAFFIC"                                                      
#> apiname     "RAW_E_TRAFFIC"                                                      
#> acsname     ""                                                                   
#> csvname     "PTRAF"                                                              
#> basevarname "traffic.score"                                                      
#> shortlabel  "Traffic"                                                            
#> longname    "Traffic Proximity and Volume (daily traffic count/distance to road)"
#> varlist     "names_e"