Titanic

library(visdat) # this loads the Package visdat
library(stargazer) # this loads the stargazer package
## 
## Please cite as:
##  Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
train <- read.csv("C:/Users/Adi/Desktop/temp for school/train.csv") # this loads the dataset from the computer directory and assigns it a variable
df <- train # this gives the information to Dataframe variable.
vis_miss(df) # vis_miss finds the data that is missing and reports it 

vis_dat(df) # vis_dat makes charts of the missing data in percentages

stargazer(df,  type = "text", title = "Statistics of Titanic Passengers", notes = "Age is missing 177 variables." ) # stargazer organizes the data and make a table with all the statistics
## 
## Statistics of Titanic Passengers
## ==============================================
## Statistic    N   Mean   St. Dev.  Min    Max  
## ----------------------------------------------
## PassengerId 891 446.000 257.354    1     891  
## Survived    891  0.384   0.487     0      1   
## Pclass      891  2.309   0.836     1      3   
## Age         714 29.699   14.526  0.420 80.000 
## SibSp       891  0.523   1.103     0      8   
## Parch       891  0.382   0.806     0      6   
## Fare        891 32.204   49.693  0.000 512.329
## ----------------------------------------------
## Age is missing 177 variables.