library(pastecs)
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:pastecs':
##
## first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(patchwork)
Animalcare <- read.csv("Animal_Care_and_Control_Division_Annual_Statistics-1.csv")
Animalcare <- clean_names(Animalcare)
head(Animalcare)
## year number_of_employees number_of_division_vehicles annual_budget
## 1 2004 15.150 3 782931
## 2 2005 16.600 3 760206
## 3 2006 16.600 3 1030661
## 4 2007 17.230 3 1062946
## 5 2008 17.725 3 1132507
## 6 2009 17.975 3 1164248
## owner_surrenders strays impounds_by_aco_added_in_2015 total_intake_of_animals
## 1 2351 3257 NA 5608
## 2 2104 3038 NA 5142
## 3 2361 2800 NA 5161
## 4 2294 2519 NA 4813
## 5 2131 2690 NA 4821
## 6 2203 2316 NA 4591
## adoptions return_to_owner euthanized
## 1 1896 558 2277
## 2 1866 542 1724
## 3 1737 554 1856
## 4 1825 523 1753
## 5 1849 544 1721
## 6 1893 452 1612
## transported_to_other_shelters_and_rescues fostered_animals service_calls
## 1 592 NA NA
## 2 670 380 1525
## 3 657 700 2900
## 4 539 800 2950
## 5 431 600 2700
## 6 275 712 2515
## emergency_call_outs grants_received annual_adoption_revenue
## 1 150 0 13146
## 2 150 18925 112649
## 3 150 5555 105401
## 4 150 0 100170
## 5 150 11215 106627
## 6 97 37498 112188
names(Animalcare)
## [1] "year"
## [2] "number_of_employees"
## [3] "number_of_division_vehicles"
## [4] "annual_budget"
## [5] "owner_surrenders"
## [6] "strays"
## [7] "impounds_by_aco_added_in_2015"
## [8] "total_intake_of_animals"
## [9] "adoptions"
## [10] "return_to_owner"
## [11] "euthanized"
## [12] "transported_to_other_shelters_and_rescues"
## [13] "fostered_animals"
## [14] "service_calls"
## [15] "emergency_call_outs"
## [16] "grants_received"
## [17] "annual_adoption_revenue"
stat.desc(Animalcare$annual_budget)
## nbr.val nbr.null nbr.na min max range
## 2.200000e+01 0.000000e+00 0.000000e+00 7.602060e+05 2.224715e+06 1.464509e+06
## sum median mean SE.mean CI.mean.0.95 var
## 3.102022e+07 1.290248e+06 1.410010e+06 8.795570e+04 1.829139e+05 1.701965e+11
## std.dev coef.var
## 4.125488e+05 2.925857e-01
Animalcare_clean <- Animalcare %>%
filter(!is.na(annual_budget))
sum(is.na(Animalcare_clean$annual_budget))
## [1] 0
ggplot(Animalcare_clean, aes(x = annual_budget)) +
geom_histogram(bins = 10, fill = "steelblue", color = "white") +
labs(title = "Histogram of Annual Budget",
x = "Annual Budget ($)",
y = "Frequency")

Animalcare_clean <- Animalcare_clean %>%
mutate(log_annual_budget = log(annual_budget))
ggplot(Animalcare_clean, aes(x = log_annual_budget)) +
geom_histogram(bins = 10, fill = "darkorange", color = "white") +
labs(title = "Histogram of Log-Transformed Annual Budget",
x = "Log of Annual Budget",
y = "Frequency")
