# Airbnb stats that may not be completely accurate airbnb <- list( countries = 220, cities = 1e5, avg_stay = 4.326, avg_cost = 184.952, hosts = 4.12e6 )
```r`r ''` `r paste(knitr::knit_code$get("airbnb-data"), collapse = "\n")` ```
With standard inline R code in R Markdown, we can write the following:
* Airbnb includes listings in `r airbnb$cities` cities in `r airbnb$countries` countries from around `r airbnb$hosts` hosts. The average guest stays `r airbnb$avg_stay` nights at a rate of `r airbnb$avg_cost` per night.
r I(airbnb$countries)
countries
from around 4.12 × 10^6 hosts.
The average guest stays r airbnb$avg_stay
nights
at a rate of r airbnb$avg_cost
per night.Using epoxy
and the light-weight fmt()
function from epoxy_transform_format()
,
we can improve the readability and formatting of the interwoven numbers.
```r`r ''` `r paste(knitr::knit_code$get("my-style"), collapse = "\n")` ``` ```{epoxy .transformer = my_style}`r ''` `r paste(knitr::knit_code$get("airbnb-epoxy"), collapse = "\n")` ```
# Define number/dollar format to apply consistently my_style <- epoxy_transform_format( dollar = scales::label_dollar(accuracy = 1), number = scales::label_number( accuracy = 0.1, scale_cut = scales::cut_short_scale() ) )
{epoxy airbnb-epoxy, .transformer = my_style}
* Airbnb includes listings in {fmt(airbnb$cities, ",")} cities
in {fmt(airbnb$countries, "auto")} countries
from around {fmt(airbnb$hosts, "#")} hosts.
The average guest stays {fmt(airbnb$avg_stay, "#")} nights
at a rate of {fmt(airbnb$avg_cost, "$")} per night.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.