alperyilmaz / dav-exercises

Exercise questions submitted by Data Analysis and Visualization with R course students at YTU
GNU General Public License v3.0
1 stars 2 forks source link

Survived boys of Titanic 1405A044 #56

Open 1405A044 opened 6 years ago

1405A044 commented 6 years ago

Question

As we know, the luxury steamship RMS Titanic sank in the early hours of April 15, 1912, off the coast of Newfoundland in the North Atlantic after sideswiping an iceberg during its maiden voyage. Of the 2,240 passengers and crew on board, more than 1,500 lost their lives in the disaster. There were those who get rid of this ship. Utilizing the Titanic data, please find out how many survived persons are boys(male children) and please find the ratio of survived boys to all survived.

Answer: Survived boys are 29 and percent=4.078762%

install.packages("titanic")
library(dplyr)
library(readr)

Titanic_df <- data.frame(Titanic) 

Titanic_survived_boy <- Titanic_df %>%
  group_by(Sex)%>%
  select(Age,Survived,Freq) %>%
  filter(Sex=="Male",Age=="Child",Survived=="Yes")

  n_Titanic_survived_boy <- sum(Titanic_survived_boy$Freq)

Titanic_survived <- Titanic_df %>%
  group_by(Sex)%>%
  select(Age,Survived,Freq) %>%
  filter(Survived=="Yes")

  n_Titanic_survived <- sum(Titanic_survived$Freq)

percent= (n_Titanic_survived_boy/n_Titanic_survived)*100

Additional information

Originality

Please mark relevant information with x, (ex. [x])

Is this question

If you select Inspired or Paraphrased please provide the links in markdown format ( [link](http://example.com) ). Please provide all relevant links. You can refer to DataCamp course pages if you're inspired by them.

Difficulty Level

According to you, what is the level of difficulty of the question (note: this can be modified by instructor after submission)