glue(
"{max_med_cost}"
)#> 15416.96
{epoxy}
super glue for data-driven reports and Shiny apps
Garrick Aden-Buie
posit::conf(2023)
report.Rmd
```{r}
max_med_cost <-
childcare_costs |>
# group and summarize… |>
filter(cost = max(cost)) |>
pull(cost)
```
report.Rmd
```{r}
max_med_cost <-
childcare_costs |>
# group and summarize… |>
filter(cost = max(cost)) |>
pull(cost)
```
Report: Childcare Costs
Report: Childcare Costs
.R
Infant day care costs
up to `r max_med_cost`
a year.
```{epoxy}
Infant day care costs
up to `r max_med_cost`
a year.
```
```{epoxy}
Infant day care costs
up to `r max_med_cost`
a year.
```
```{epoxy}
Infant day care costs
up to {max_med_cost}
a year.
```
```{epoxy}
Infant day care costs
up to {.dollar max_med_cost}
a year.
```
Inline epoxy transformers
{.dollar max_med_cost}
1.541696^{4}
$15,416.96
{.percent mhi_pct}
0.2376447
24%
{.comma county_pop_med}
1.595192^{6}
1,595,192
{.ordinal cost_rank}
1
1st
{.titlecase age}
infant
Infant
{.bold county_size}
very large
very large
{.italic type}
day care
day care
Infant day care in very large counties ranks 1st in childcare costs at $15,416.96 per year, or 24% of median household income.
epoxy_transform_set(
.cpm = function(x) x / 12
)
Infant day care in very large counties ranks 1st in childcare costs at $15,416.96 per year, about 1284.75 per month about $1,284.75 per month or 24% of median household income.
childcare_summary
#> # A tibble: 10 × 9
#> cost_rank county_size type age max_med_cost mhi_2018 county_pop_med n_counties mhi_pct
#> <int> <chr> <chr> <chr> <dbl> <dbl> <dbl> <int> <dbl>
#> 1 1 very large day care infant 15417. 64874 1595192 37 0.238
#> 2 2 large day care infant 13420. 68021 703619 77 0.197
#> 3 3 very large day care toddler 12121. 64874 1595192 37 0.187
#> 4 4 large day care toddler 11180 68021 703619 77 0.164
#> 5 5 very large day care preschool 11050 64874 1595192 37 0.170
#> 6 6 mid-sized day care infant 10194. 58775 179085 353 0.173
#> 7 7 large day care preschool 10078. 68021 703619 77 0.148
#> 8 8 very large home care infant 9892. 64874 1595192 37 0.152
#> 9 9 very large day care school-age 9199. 64874 1595192 37 0.142
#> 10 10 very large home care toddler 9100 64874 1595192 37 0.140
Infant day care in very large counties ranks 1st in childcare costs at $15,400 per year, about $1,300 per month or 23.8% of median household income.
Infant home care in very large counties ranks 8th in childcare costs at $9,900 per year, about $800 per month or 15.2% of median household income.
report-html.Rmd
```{epoxy_htmlepoxy_html}
in {{@bold county_size}}{{@bold county_size}} counties
```
in <strong><strong>very large</strong></strong> counties
report-latex.Rmd
```{epoxy_latexepoxy_latex}
in <<.bold county_size>><<.bold county_size>> counties
```
in \textbf{very large} counties
{epoxy}
in Reports
{epoxy}
in scripts
epoxy()
epoxy_html()
epoxy_latex()
library(shiny)
library(bslib)
ui <- page_fixed(
textInput("greetings", "Greeting", "Hello"),
textInput("company", "Company", "rstudio"),
textInput("year", "Year", "2023"),
ui_epoxy_html(
.id = "hello",
p(
"{{greetings}}, {{company}}::conf({{year}})!"
)
)
)
server <- function(input, output, session) {
output$hello <- render_epoxy(
greetings = input$greetings,
company = input$company,
year = input$year
)
}
shinyApp(ui, server)
Blend data and prose
Reusable templates
Just-in-time formatting
Reports, scripts and apps
pkg.garrickadenbuie.com/epoxy
grrrck@fosstodon.org