Skip to contents

Get URL for and view in browser a 2-page summary report similar to the EJScreen Community Report

Usage

ejam2report(
  ejamitout = testoutput_ejamit_10pts_1miles,
  sitenumber = NULL,
  analysis_title = "Summary of Analysis",
  submitted_upload_method = c("latlon", "SHP", "FIPS")[1],
  shp = NULL,
  return_html = FALSE,
  fileextension = c("html", "pdf")[1],
  filename = NULL,
  launch_browser = TRUE,
  show_ratios_in_report = TRUE,
  extratable_show_ratios_in_report = TRUE,
  extratable_title = "",
  extratable_title_top_row = "ADDITIONAL INFORMATION",
  extratable_list_of_sections = list(`Breakdown by Population Group` = names_d_subgroups,
    `Language Spoken at Home` = names_d_language,
    `Language in Limited English Speaking Households` = names_d_languageli,
    `Breakdown by Sex` = c("pctmale", "pctfemale"), Health = names_health, Age =
    c("pctunder5", "pctunder18", "pctover64"), Community =
    names_community[!(names_community %in% c("pctmale", "pctfemale",
    "pctownedunits_dupe"))], Poverty = names_d_extra, `Features and Location Information`
    = c(names_e_other, names_sitesinarea, names_featuresinarea, 
     names_flag),
    Climate = names_climate, `Critical Services` = names_criticalservice, Other =
    names_d_other_count),
  extratable_hide_missing_rows_for = as.vector(unlist(extratable_list_of_sections))
)

Arguments

ejamitout

output as from ejamit(), list with a data.table called results_bysite if sitenumber parameter is used, or a data.table called results_overall otherwise

sitenumber

If a number is provided, the report is about ejamout$results_bysite[sitenumber, ] and if no number is provided (param is NULL) then the report is about ejamout$results_overall

analysis_title

optional title of analysis

submitted_upload_method

something like "latlon", "SHP", "FIPS", etc. (just used as-is as part of the filename)

shp

provide the sf spatial data.frame of polygons that were analyzed so you can map them since they arenot in ejamitout

return_html

set TRUE to have function return HTML object instead of URL of local file

fileextension

html or .html or pdf or .pdf (assuming pdf option has been implemented). Creating PDF output from R Markdown requires that LaTeX be installed.

filename

optional path and name for report file, used by web app

launch_browser

set TRUE to have it launch browser and show report.

show_ratios_in_report

logical, whether to add columns with ratios to US and State overall values, in main table of envt/demog. info.

extratable_show_ratios_in_report

logical, whether to add columns with ratios to US and State overall values, in extra table

extratable_title

Text of overall title ABOVE the extra table

extratable_title_top_row

Text INSIDE top left cell of extra table

extratable_list_of_sections

This defines what extra indicators are shown. It is a named list of vectors, where each name is text phrase that is title of a section of the table, and each vector is the vector of colnames of output_df that are indicators to show in that section, in extra table of demog. subgroups, etc.

extratable_hide_missing_rows_for

only for the indicators named in this vector, leave out rows in table where raw value is NA, as with many of names_d_language, in extra table of demog. subgroups, etc.' #'

Value

URL of temp file or object depending on return_html, and has side effect of launching browser to view it depending on return_html

Details

This relies on build_community_report() as used in web app for viewing report on 1 site from a list of sites (or overall). You can customize the report somewhat by using parameters like extratable_list_of_sections

Note report_community_download() is similar to build_community_report() but renders and saves the report as an HTML or pdf file for download instead of returning HTML for display in a browser.

Examples

#out <- ejamit(testpoints_10, radius = 3, include_ejindexes = T)
out <- testoutput_ejamit_10pts_1miles

ejam2report(out)
#> mydf seems to be a list of tables such as output from ejamit() so using just the results_bysite table here
#> [1] "/tmp/RtmpuU15oN/EJAM_community_report_Summary_of_Analysis_1_Miles_from_places_by_latlon.html"
table_gt_from_ejamit_overall(out$results_overall)
Socioeconomic Indicators Value Average
in State
1
Percentile
in State
1
Average
in USA
Percentile
in USA
Ratio to
State Avg.
Ratio to
USA Avg.
Demographic Index USA 135.26% 135.10% 56.62 134.07% 58 1.01 1.0
Supplemental Demographic Index USA 127.51% 147.42% 41.41 164.23% 33 0.83 0.8
% People of Color 53% 44% 62 40% 67 1.2 1.3
% Low Income 23% 27% 50 30% 43 0.8 0.7
% Unemployed 6% 6% 63 6% 68 1.1 1.2
% in limited English-speaking Households 6% 7% 67 5% 77 0.8 1.2
% with Less Than High School Education 9% 12% 49 11% 54 0.7 0.8
% under Age 5 6% 5% 66 5% 65 1.2 1.2
% over Age 64 13% 17% 36 18% 35 0.7 0.7
1 Avg. in state means the average indicator value, among all the residents at these sites, using the statewide value in each resident's state. Percentile in state means the same, but using the site-specific value (expressed as a percentile) where each resident lives.
table_tall_from_overall(out$results_overall) #> Error in table_tall_from_overall(out$results_overall): could not find function "table_tall_from_overall" x <- ejam2report(out, sitenumber = 1) table_gt_from_ejamit_1site(out$results_bysite[1, ])
Socioeconomic Indicators Value Average
in State
1
Percentile
in State
1
Average
in USA
Percentile
in USA
Ratio to
State Avg.
Ratio to
USA Avg.
Demographic Index USA 173.91% 183.43% 58.00 134.07% 71 1.08 1.3
Supplemental Demographic Index USA 145.91% 149.41% 46.00 164.23% 45 0.90 0.9
% People of Color 87% 62% 75 40% 87 1.4 2.2
% Low Income 15% 28% 33 30% 28 0.6 0.5
% Unemployed 4% 6% 45 6% 56 0.7 0.8
% in limited English-speaking Households 11% 8% 72 5% 86 1.3 2.4
% with Less Than High School Education 17% 16% 63 11% 76 1.1 1.5
% under Age 5 4% 5% 37 5% 39 0.7 0.7
% over Age 64 11% 16% 38 18% 31 0.7 0.6
1 Avg. in state means the average indicator value, among all the residents at these sites, using the statewide value in each resident's state. Percentile in state means the same, but using the site-specific value (expressed as a percentile) where each resident lives.
browseURL(x)