Which state has the highest pell award per student?
Show code
tbl_viz<-df_tbl%>%arrange(-sum_award)%>%gt()%>%gt::cols_label(state ='State', sum_award ='Total Pell $', sum_recipients ='Total Pell Recipients', award_per_recipient ='Avg Pell Award $')%>%tab_header(title =md("**Pell Grant Awards in 2017**"), subtitle =md("Schools in **New Hampshire** and **Puero Rico** average the lowest and highest average awards respectively"))%>%tab_source_note(source_note ="Data from Tidy Tuesday Week 35 (2022)")%>%fmt_currency(columns =c(sum_award, award_per_recipient), decimals =0)%>%fmt_number(columns =c(sum_recipients), decimals =0)%>%gt_highlight_rows( rows =c(10,39), fill ="lightgrey", bold_target_only =TRUE, target_col =state)%>%gt_hulk_col_numeric(award_per_recipient)%>%tab_style( locations =cells_column_labels(columns =everything()), style =list(#thick bordercell_borders(sides ="bottom", weight =px(3)),#make text boldcell_text(weight ="bold")))%>%#apply different style to titletab_style(locations =cells_title(groups ="title"), style =list(cell_text(weight ="bold", size =24)))%>%opt_all_caps()%>%opt_table_font( font =list(google_font("Nunito Sans"),default_fonts()))%>%tab_options(#remove border between column headers and title column_labels.border.top.width =px(3), column_labels.border.top.color ="transparent",#remove border around the table table.border.top.color ="transparent", table.border.bottom.color ="transparent",#adjust font sizes and alignment source_notes.font.size =12, heading.align ="left")
7. Save
Show code
# Save the plot as PNGggsave( filename =glue("tt_{tt_year}_{tt_week}.png"), plot =viz_pell_colorado, width =5, height =3.5, units ="in", dpi =320)tbl_viz%>%gtsave( filename =glue("tt_{tt_year}_{tt_week}_tbl.png"), path =here::here())# make thumbnail for pagemagick::image_read(glue("tt_{tt_year}_{tt_week}.png"))%>%magick::image_resize(geometry ="400")%>%magick::image_write(glue("tt_{tt_year}_{tt_week}_thumbnail.png"))