I produce this simple table with R code below:
# A tibble: 9 × 3
report_year bank_financial amount
<fct> <chr> <dbl>
1 2013 NPL % 0.0266
2 2014 NPL % 0.0224
3 2015 NPL % 0.0176
4 2016 NPL % 0.0164
5 2017 NPL % 0.0120
6 2018 NPL % 0.0113
7 2019 NPL % 0.0101
8 2020 NPL % 0.0137
9 2021 NPL % 0.0118
convetional_npl <- df %>% filter((bank_financial == 'Total Impaired Loan' | bank_financial == 'Gross Loan'), category == 'Universal Commercial Banks') %>%
group_by(report_year, bank_financial) %>% summarise(amount = sum(amount), .groups = 'drop') %>%
pivot_wider(names_from = bank_financial, values_from = amount) %>%
mutate(report_year = as_factor(report_year),
`NPL %` = `Total Impaired Loan` / `Gross Loan`) %>%
pivot_longer(!report_year, names_to = 'bank_financial', values_to = 'amount') %>%
filter(bank_financial == 'NPL %')
Try to create a line chart with
convetional_npl %>% ggplot(aes(report_year, bank_financial)) + geom_line()
R studio prompted me with warning message below
`geom_line()`: Each group consists of only one observation.
ℹ Do you need to adjust the group aesthetic?
Hope someone can advise me on this warning message and produce the complete chart.