Skip to contents

multiplies some data to rescale percentages stored as 0 to 1, into 0-100

Usage

table_x100(df, cnames = names_pct_as_fraction_ejamit)

Arguments

df

data.frame but can be data.table

cnames

colnames in df of indicators to multiply by 100, like those in

names_pct_as_fraction_ejamit,

names_pct_as_fraction_blockgroupstats, or

names_pct_as_fraction_ejscreenit

Value

df with data in specified columns multiplied by 100

Examples

out <- testoutput_ejamit_10pts_1miles
mytable <- out$results_bysite[1:2, ..names_these]
table_signif_round_x100(mytable)
#> Error in table_signif_round_x100(mytable): could not find function "table_signif_round_x100"
# same as this:
table_signif(
  table_round(
    table_x100(
      mytable, names_pct_as_fraction_ejamit
    )
  )
)
#> Error in table_signif(table_round(table_x100(mytable, names_pct_as_fraction_ejamit))): could not find function "table_signif"

 y = data.frame(pctlowinc = 1:2, pctpre1960 = 1:2, avg.pctunemployed = 1:2, avg.pctpre1960 = 1:2)
 
 table_x100(y, names_pct_as_fraction_ejscreenit)
#> Error in table_x100(y, names_pct_as_fraction_ejscreenit): could not find function "table_x100"
 table_x100(y, names_pct_as_fraction_blockgroupstats)
#> Error in table_x100(y, names_pct_as_fraction_blockgroupstats): could not find function "table_x100"
 table_x100(y, names_pct_as_fraction_ejamit)
#> Error in table_x100(y, names_pct_as_fraction_ejamit): could not find function "table_x100"
 cat("\n\n")
#> 
#> 
 names_pct_as_fraction_ejscreenit
#>  [1] "pctnhaiana"         "pctnhnhpia"         "pctba"             
#>  [4] "pctaa"              "pctaiana"           "pctnhpia"          
#>  [7] "pctotheralone"      "pctmulti"           "pctwa"             
#> [10] "pctlan_ie"          "pctlan_api"         "pctlan_non_english"
#> [13] "pctpoor"           
#> 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-03"
 names_pct_as_fraction_blockgroupstats
#>  [1] "pctlowinc"       "pctlingiso"      "pctunemployed"   "pctlths"        
#>  [5] "pctunder5"       "pctover64"       "pctmin"          "pcthisp"        
#>  [9] "pctnhba"         "pctnhaa"         "pctnhaiana"      "pctnhnhpia"     
#> [13] "pctnhotheralone" "pctnhmulti"      "pctnhwa"         "pctba"          
#> [17] "pctaa"           "pctaiana"        "pctnhpia"        "pctotheralone"  
#> [21] "pctmulti"        "pctwa"           "pctlan_ie"       "pctlan_api"     
#> [25] "pctlan_other"    "pctlan_spanish"  "pctspanish_li"   "pctie_li"       
#> [29] "pctapi_li"       "pctother_li"     "pctpoor"         "pctdisability"  
#> [33] "lowlifex"        "pctnobroadband"  "pctunder18"      "pctover17"      
#> [37] "pctmale"         "pctfemale"       "pctownedunits"  
#> 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-03"
 names_pct_as_fraction_ejamit
#>  [1] "pctlowinc"                 "pctlingiso"               
#>  [3] "pctunemployed"             "pctlths"                  
#>  [5] "pctunder5"                 "pctover64"                
#>  [7] "pctmin"                    "avg.pctlowinc"            
#>  [9] "avg.pctlingiso"            "avg.pctunemployed"        
#> [11] "avg.pctlths"               "avg.pctunder5"            
#> [13] "avg.pctover64"             "avg.pctmin"               
#> [15] "state.avg.pctlowinc"       "state.avg.pctlingiso"     
#> [17] "state.avg.pctunemployed"   "state.avg.pctlths"        
#> [19] "state.avg.pctunder5"       "state.avg.pctover64"      
#> [21] "state.avg.pctmin"          "pcthisp"                  
#> [23] "pctnhba"                   "pctnhaa"                  
#> [25] "pctnhaiana"                "pctnhnhpia"               
#> [27] "pctnhotheralone"           "pctnhmulti"               
#> [29] "pctnhwa"                   "avg.pcthisp"              
#> [31] "avg.pctnhba"               "avg.pctnhaa"              
#> [33] "avg.pctnhaiana"            "avg.pctnhnhpia"           
#> [35] "avg.pctnhotheralone"       "avg.pctnhmulti"           
#> [37] "avg.pctnhwa"               "state.avg.pcthisp"        
#> [39] "state.avg.pctnhba"         "state.avg.pctnhaa"        
#> [41] "state.avg.pctnhaiana"      "state.avg.pctnhnhpia"     
#> [43] "state.avg.pctnhotheralone" "state.avg.pctnhmulti"     
#> [45] "state.avg.pctnhwa"         "pctba"                    
#> [47] "pctaa"                     "pctaiana"                 
#> [49] "pctnhpia"                  "pctotheralone"            
#> [51] "pctmulti"                  "pctwa"                    
#> [53] "pctlan_ie"                 "pctlan_api"               
#> [55] "pctlan_other"              "pctlan_spanish"           
#> [57] "pctlan_non_english"        "pctspanish_li"            
#> [59] "pctie_li"                  "pctapi_li"                
#> [61] "pctother_li"               "pctpoor"                  
#> [63] "pctdisability"             "lowlifex"                 
#> [65] "avg.pctdisability"         "avg.lowlifex"             
#> [67] "avg.lifexyears_synonym"    "state.avg.pctdisability"  
#> [69] "state.avg.lowlifex"        "pctunder18"               
#> [71] "pctover17"                 "pctmale"                  
#> [73] "pctfemale"                 "pctownedunits"            
#> 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-03"
 cat("\n\n")
#> 
#> 
 ytable = data.table(pctlowinc = 1:2, pctpre1960 = 1:2, avg.pctunemployed = 1:2, avg.pctpre1960 = 1:2)
#> Error in data.table(pctlowinc = 1:2, pctpre1960 = 1:2, avg.pctunemployed = 1:2,     avg.pctpre1960 = 1:2): could not find function "data.table"
 
 table_x100(ytable, names_pct_as_fraction_blockgroupstats) 
#> Error in table_x100(ytable, names_pct_as_fraction_blockgroupstats): could not find function "table_x100"
 table_x100(ytable, names_pct_as_fraction_ejamit)
#> Error in table_x100(ytable, names_pct_as_fraction_ejamit): could not find function "table_x100"
 cat("\n\n")
#> 
#> 
 y
#>   pctlowinc pctpre1960 avg.pctunemployed avg.pctpre1960
#> 1         1          1                 1              1
#> 2         2          2                 2              2
 ytable
#> Error: object 'ytable' not found