Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

in r please. some of the data set provided. data set is too long to fit. please help. thanks 1. (40 points) Import the Titanic

in r please. some of the data set provided. data set is too long to fit. please help. thanks image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
1. (40 points) Import the Titanic Passengers_New.csv data set, assign the data frame to the variable named titanic and work on the following items step by step: a. (3 pts) Check the data frame structure. How many variables and observations are there in the data set? b. (5 pts) Name column consists of three elements: LastName, Title and Name. For example, in the first observation (Allen, Miss. Elisabeth Walton) Allen" is the last name, "Miss" is the title of the passenger and "Elisabeth Walton" is the name (some passengers has more than 2 names) of the passenger. Separate the Name column into two columns, namely Title and Full_Name, which will include passenger titles, and full names of the passengers, respectively. Show the first 2 rows of titanic c. (3 pts) In Ticket #column, some data points have white space. For example, PC 17609 has white space between PC and 17609. Remove the white space in the data points in Ticket #column. Show the observations 11 through 13. d. (3 pts) Remove the white space in Cabin column values, and pad the Cabin values with 0 on the left until width of the value is 9. e. (3 pts) Home / Destination column includes home and destination of the passengers which is separated by a forward slash (/). Separate this variable into two columns, namely Home and Destination. Show the first 5 rows of titanic f. (3 pts) Examine Sex and Passenger Class. Are there any typographical errors? If so, correct them. You will use histogram to detect typographical errors. Show your histogram before and after replacing erroneous data points. g. (3 pts) Replace male with M, and female with F in Sex variable. h. (3 pts) Delete Title, Body, Destination and Midpoint Age variables from titanic data frame. Show the first 2 rows of titanic. i. (3 pts) How many missing values are there in each variable. j. (3 pts) Delete the rows with missing values. k. (3 pts) Check the structure of the titanic data frame. 1. (5 pts) Demonstrate the histograms for Passenger Class, Survived, Sex, and Age variables. Demonstrate boxplots for Age and Lifeboat variables. BE . VE OBRE ***** 1 T IIIIIIII!!!!!!!!!!!!!! and Children Cabin 24160 2113375 85 2.5 15155 3515 Montreal, QC ON Montreal, Chest ON 5 2.5 2226 5 Marta P/ CON 27.5 ES 475 77.9503 13502 312050 37.5 Montevideo, Uruguay 72.5 51.4752 CHOL 49.5042 222 525 264 227.525 C62054 PC 17600 RC 1775 RC 17757 RC 17 c c 17.5 225 225 2704 125 C17310 RC 155 25.925 247.520 858 c 225 11613 762917 DIS 75.24376 3050 W.MN 37.5 25 11751 DOS New York, NY 47.5 30 27.5 C 17757 113 27.5 c 275 227 525 2217712 CM 26 91.0712049 1.0992 49 135 6333 C 27.5 17.5 RC 1716 27.5 S 5 31 C Gen Ride 42.5 360 364.66 113783 5 Side, England Cand, Ohio London, Winnipeg, MB 57.5 42.5 10 022 5 NC 12000 47.5 55 E33 2-on-Sea, England Ohio 22.5 113054 26.55 30.5 50.498 830 5 C 112379 PC 176 Deco 27.72014 51.492 Ces 76.2917 DIS c c? 42.5 113050 47.5 113790 5 26,275 24 52.5 PC1276 RC 17606 PC 17755 KC 17755 695 c. C> Hungary / Germantown, Philip 37.5 C 57.5 5123252 51 53 55 5123292 851 853 655 5 351 353 ES 47.1 325 27.5 471 17.5 12.5 120 5 BI 151 1 15 C C 2 2 5 ww 25 PP 5 1 . . RESP 1 . 2010 3.15 S . SS . 1 . . . . 5 . 1 1 we SH $ 1 . RUS PC 22 cm 5 . WOMET . 1 . 1 5 . 1 1 . EST SY s 1 1 1 . PC TT . 1 . CIN . 1 29 02.09 1 . $ 5 1 1 130 5 2 2 2 1 2 1 5 1 . 1 1 WIN BIS . . 1 TUTE 1. (40 points) Import the Titanic Passengers_New.csv data set, assign the data frame to the variable named titanic and work on the following items step by step: a. (3 pts) Check the data frame structure. How many variables and observations are there in the data set? b. (5 pts) Name column consists of three elements: LastName, Title and Name. For example, in the first observation (Allen, Miss. Elisabeth Walton) Allen" is the last name, "Miss" is the title of the passenger and "Elisabeth Walton" is the name (some passengers has more than 2 names) of the passenger. Separate the Name column into two columns, namely Title and Full_Name, which will include passenger titles, and full names of the passengers, respectively. Show the first 2 rows of titanic c. (3 pts) In Ticket #column, some data points have white space. For example, PC 17609 has white space between PC and 17609. Remove the white space in the data points in Ticket #column. Show the observations 11 through 13. d. (3 pts) Remove the white space in Cabin column values, and pad the Cabin values with 0 on the left until width of the value is 9. e. (3 pts) Home / Destination column includes home and destination of the passengers which is separated by a forward slash (/). Separate this variable into two columns, namely Home and Destination. Show the first 5 rows of titanic f. (3 pts) Examine Sex and Passenger Class. Are there any typographical errors? If so, correct them. You will use histogram to detect typographical errors. Show your histogram before and after replacing erroneous data points. g. (3 pts) Replace male with M, and female with F in Sex variable. h. (3 pts) Delete Title, Body, Destination and Midpoint Age variables from titanic data frame. Show the first 2 rows of titanic. i. (3 pts) How many missing values are there in each variable. j. (3 pts) Delete the rows with missing values. k. (3 pts) Check the structure of the titanic data frame. 1. (5 pts) Demonstrate the histograms for Passenger Class, Survived, Sex, and Age variables. Demonstrate boxplots for Age and Lifeboat variables. BE . VE OBRE ***** 1 T IIIIIIII!!!!!!!!!!!!!! and Children Cabin 24160 2113375 85 2.5 15155 3515 Montreal, QC ON Montreal, Chest ON 5 2.5 2226 5 Marta P/ CON 27.5 ES 475 77.9503 13502 312050 37.5 Montevideo, Uruguay 72.5 51.4752 CHOL 49.5042 222 525 264 227.525 C62054 PC 17600 RC 1775 RC 17757 RC 17 c c 17.5 225 225 2704 125 C17310 RC 155 25.925 247.520 858 c 225 11613 762917 DIS 75.24376 3050 W.MN 37.5 25 11751 DOS New York, NY 47.5 30 27.5 C 17757 113 27.5 c 275 227 525 2217712 CM 26 91.0712049 1.0992 49 135 6333 C 27.5 17.5 RC 1716 27.5 S 5 31 C Gen Ride 42.5 360 364.66 113783 5 Side, England Cand, Ohio London, Winnipeg, MB 57.5 42.5 10 022 5 NC 12000 47.5 55 E33 2-on-Sea, England Ohio 22.5 113054 26.55 30.5 50.498 830 5 C 112379 PC 176 Deco 27.72014 51.492 Ces 76.2917 DIS c c? 42.5 113050 47.5 113790 5 26,275 24 52.5 PC1276 RC 17606 PC 17755 KC 17755 695 c. C> Hungary / Germantown, Philip 37.5 C 57.5 5123252 51 53 55 5123292 851 853 655 5 351 353 ES 47.1 325 27.5 471 17.5 12.5 120 5 BI 151 1 15 C C 2 2 5 ww 25 PP 5 1 . . RESP 1 . 2010 3.15 S . SS . 1 . . . . 5 . 1 1 we SH $ 1 . RUS PC 22 cm 5 . WOMET . 1 . 1 5 . 1 1 . EST SY s 1 1 1 . PC TT . 1 . CIN . 1 29 02.09 1 . $ 5 1 1 130 5 2 2 2 1 2 1 5 1 . 1 1 WIN BIS . . 1 TUTE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Accounting questions