ggplot(data = myData) +
geom_bar(mapping = aes(x = country))
myData %>%
# filter out Cancers
filter(`Cancers (%)` < 12)
## # A tibble: 0 × 35
## # ℹ 35 variables: country <chr>, country_code <chr>, year <dbl>,
## # Cardiovascular diseases (%) <dbl>, Cancers (%) <dbl>,
## # Respiratory diseases (%) <dbl>, Diabetes (%) <dbl>, Dementia (%) <dbl>,
## # Lower respiratory infections (%) <dbl>, Neonatal deaths (%) <dbl>,
## # Diarrheal diseases (%) <dbl>, Road accidents (%) <dbl>,
## # Liver disease (%) <dbl>, Tuberculosis (%) <dbl>, Kidney disease (%) <dbl>,
## # Digestive diseases (%) <dbl>, HIV/AIDS (%) <dbl>, Suicide (%) <dbl>, …
Not applicable, did not work
Not applicable, did not work with any data
myData %>%
count(`Cancers (%)`, `Diabetes (%)`) %>%
ggplot(aes(x = `Cancers (%)`, y = `Diabetes (%)`, fill = n)) +
geom_tile()
library(hexbin)
## Warning: package 'hexbin' was built under R version 4.3.3
myData %>%
ggplot(aes(x = year, y = country)) +
geom_hex()
## Warning: Computation failed in `stat_binhex()`
## Caused by error in `if (diff(ybnds) <= 0) ...`:
## ! missing value where TRUE/FALSE needed
library(modelr)
mod <- lm(log(price) ~ log(carat), data = diamonds)
diamonds4 <- diamonds %>%
modelr::add_residuals(mod) %>%
mutate(resid = exp(resid))
diamonds4 %>%
ggplot(aes(carat, resid)) +
geom_point()
diamonds4 %>%
ggplot(aes(cut, resid)) +
geom_boxplot()