train <- read.csv('train.csv')
names(train)
## [1] "PassengerId" "Survived" "Pclass" "Name" "Sex"
## [6] "Age" "SibSp" "Parch" "Ticket" "Fare"
## [11] "Cabin" "Embarked"
ggplot2::qplot(x = Pclass, data = train)
## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
I chose to analyze the Pclass from the data. I wanted to answer the
question “how many people were in the 1st, 2nd, and 3rd class?” This
seems important to know because there could be a correlation between how
many people from each class survived or died. It would not be surprising
to find that the majority of lives lost were in the lowest class since
the individuals with more “status” would likely be saved first. It is
interesting to conclude that the amount of passengers in the 3rd class
were more than the 1st and 2nd classes combined. More than double the
amount of passengers died that day, so it is easy to assume that most of
the deaths were in the 3rd class.
ggplot2::qplot(x = Survived, data = train)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
It is known that many people lost their lives when the Titanic sunk, but
I was curious to answer the question “how many survivors were there and
how many deaths were there?” Creating the plot to visualize the numbers
made more of a significant impact on me than just reading the numbers on
a page. Seeing the graph made me realize that the amount of deaths was
nearly double the amount of survivors. This solidifies the theory that
safety was not even considered to be necessary on an “unsinkable” ship.
As a result, many passengers died due to not having access to
life-saving devices.