Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
?stargazerstargazer(x, type ="text", title ="Summary Statistics Table", digits =1)
Summary Statistics Table
========================================
Statistic N Mean St. Dev. Min Max
----------------------------------------
PassengerId 714 448.6 259.1 1 891
Survived 714 0.4 0.5 0 1
Pclass 714 2.2 0.8 1 3
Age 714 29.7 14.5 0.4 80.0
SibSp 714 0.5 0.9 0 5
Parch 714 0.4 0.9 0 6
Fare 714 34.7 52.9 0.0 512.3
----------------------------------------
# Load the packagelibrary(ggplot2)ggplot(x, aes(x =factor(Survived), y = Age)) +geom_boxplot() +labs(Title ="Class Distribution by Survival",x ="Survived",y ="Class")
ggplot(data = df_clean, aes(x = Age)) +# creating a histogramgeom_histogram(binwidth =2, fill ="lightpink", color ="black") +facet_wrap(~ Survived) +labs(title ="Histogram of Age by Survival Status", # titlex ="Age", # axis labelsy ="Frequency") +theme_minimal()
My final takeaway from this chart is that age was not a big factor in if a passenger survived or didn’t since the graphs follow a similar curve.