Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would like to know the Rstudio code of each of the following questions. Could you show me how to start with? Reading in the

I would like to know the Rstudio code of each of the following questions. Could you show me how to start with?

  1. Reading in the dataset using read_csv(file = "titanic_dataset.csv") causes some of the columns to be converted into inconvenient data types. Fix this so that your later analysis does not run into problems. Use the col_types = cols() argument within read_csv() as explained in this section of R for Data Science, http://r4ds.had.co.nz/data-import.html#problems, to change the data type defaults for the following columns:

    • Convert survived to the logical data type

    • Convert pclass to the character data type

    • Convert sibsp to the character data type

    • Convert parch to the character data type

    After you get the inputs to read_csv() to work correctly, assign the dataset to a variable called titanic.

    Important!

    You should not try to load the dataset by clicking the file titanic_dataset.csv in the File Explorer panel or by using File Import Dataset. As an example,

    titanic <- read_csv(file = "titanic_dataset.csv")

    would read the datafile and assign the loaded dataset to a variable called titanic.

  2. Compute how many known passengers were on the Titanic. Do not just print the table, use a function to count the passengers.

  3. A famous directive for evacuating the Titanic was women and children first. Use your dplyr functions to verify the first part of this statement by counting the number of men and women that survived and that died. Then, using those counts, calculate the fraction of women that survived, Number of female survivorsTotal number of female passengers\dfrac{\text{Number of female survivors}}{\text{Total number of female passengers}}Total number of female passengersNumber of female survivors and the fraction of men that survived, Number of male survivorsTotal number of male passengers\dfrac{\text{Number of male survivors}}{\text{Total number of male passengers}}Total number of male passengersNumber of male survivors. Do your computations support the idea that women were more likely to survive? Why or why not?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

Evaluate projects using the unadjusted rate of return.

Answered: 1 week ago

Question

Discuss communication challenges in a global environment.

Answered: 1 week ago