── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
Simplify the column names of the nursing home dataset
df_home <-read_excel("data/nursing_home.xlsx") |>rename("n1"="Subsidised Service-Subvented and Self-financing Home Operated by NGO","n2"="Subsidised Service-Contract Home","n3"="Subsidised Service-Private Home Participating in Enhanced Bought Place Scheme-EA1","n4"="Subsidised Service-Private Home Participating in Enhanced Bought Place Scheme-EA2","n5"="Non-Subsidised Service-Home Operated by NGO","n6"="Non-Subsidised Service-Contract Home","n7"="Non-Subsidised Service-Private Home") |>select(district, n1, n2, n3, n4, n5, n6, n7)
Save the cleaned data
# save the df_cleaned to RDS filesaveRDS(df_clean, "data/abuse_cleaned.rds")# save the df_home to RDS filesaveRDS(df_home, "data/nursing_home.rds")