library(tidyverse)
## ── 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.2 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── 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)
setwd("C:/Users/andie/Downloads/nursing_homes_including_rehab_services_current_data")
library(readr)
NH_ProviderInfo_Jul2025 <- read_csv("NH_ProviderInfo_Jul2025.csv")
## Rows: 14752 Columns: 100
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (21): CMS Certification Number (CCN), Provider Name, Provider Address, ...
## dbl (75): Telephone Number, Number of Certified Beds, Average Number of Res...
## date (4): Date First Approved to Provide Medicare and Medicaid Services, Ra...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Exploratory Statistics #1:
summary(NH_ProviderInfo_Jul2025$`Registered Nurse turnover`)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0.00 28.60 42.90 43.83 58.30 100.00 2059
Exploratory Statistics #2:
ggplot(NH_ProviderInfo_Jul2025, aes(x=`Number of Substantiated Complaints`))+
geom_histogram(binwidth=15)
Exploratory Statistics #3:
ggplot(NH_ProviderInfo_Jul2025, aes(x=`Reported Total Nurse Staffing Hours per Resident per Day`,y=`Overall Rating`))+
geom_point()
## Warning: Removed 538 rows containing missing values or values outside the scale range
## (`geom_point()`).
Exploratory Statistics #4:
cor(NH_ProviderInfo_Jul2025$`Number of Substantiated Complaints`, NH_ProviderInfo_Jul2025$`Overall Rating`, use= "complete.obs")
## [1] -0.4129623