#Load Packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## âś” dplyr     1.2.1     âś” readr     2.2.0
## âś” forcats   1.0.1     âś” stringr   1.6.0
## âś” ggplot2   4.0.3     âś” tibble    3.3.1
## âś” lubridate 1.9.5     âś” tidyr     1.3.2
## âś” purrr     1.2.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)
#Name Data
data <- read_csv("hotline_data.csv")
## Rows: 2184 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (5): State, Timeframe, Call Average Time to Answer, Text Average Time to...
## dbl (6): Number of Routed Calls, Call Answer Rate, Number of Routed Texts, T...
## 
## ℹ 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.
calls_test <- data %>% select(`Number of Routed Calls`,`Call Answer Rate`) %>% arrange(-`Number of Routed Calls`,`Call Answer Rate`) 

calls_test
## # A tibble: 2,184 Ă— 2
##    `Number of Routed Calls` `Call Answer Rate`
##                       <dbl>              <dbl>
##  1                    47623              0.883
##  2                    46783              0.885
##  3                    46569              0.883
##  4                    45458              0.873
##  5                    43907              0.890
##  6                    43484              0.890
##  7                    41287              0.899
##  8                    41173              0.890
##  9                    40681              0.891
## 10                    40292              0.903
## # ℹ 2,174 more rows
#Correlation Between Number of Routed Call and Call Answer Rate for the 988 Hotline
cor(calls_test)
##                        Number of Routed Calls Call Answer Rate
## Number of Routed Calls              1.0000000        0.1161137
## Call Answer Rate                    0.1161137        1.0000000
pairs(~`Number of Routed Calls` + `Call Answer Rate`, data=data)

#Spearman's
cor.test(data$`Number of Routed Calls`,data$`Call Answer Rate`,method="spearman")
## Warning in cor.test.default(data$`Number of Routed Calls`, data$`Call Answer
## Rate`, : cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  data$`Number of Routed Calls` and data$`Call Answer Rate`
## S = 1670890766, p-value = 0.07871
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## 0.03763128

I used Spearman’s correlation because the data did not appear to have a clear linear relationship. The results showed a very weak positive correlation (p = 0.038) between the number of routed calls and call answer rate. The p-value was 0.0787, which is greater than 0.05, indicating that the relationship was not statistically significant. Therefore, there is insufficient evidence to conclude that routed call volume is associated with call answer rates.