Question: 8. Reading spreadsheet data into R Data files we use in this class will be provided as .csv les. We have provided example code that

8. Reading spreadsheet data into R Data files we use in this class will be provided as .csv les. We have provided example code that uses the read_csv( ) function to read the patient data (Patient_Data.csv) into R, creating a tibble. We also included code to turn the categorical variable Sex into a factor variable (factor variables will be important when we build models), count the number of observations for each Sex and to create a new subset of data that only contains the observations for females. Lastly, the glimpse function is used to display information about the subset. Modify the code we provided to do the following: a) Use the count function to count the number of observations in each of the MartitalStat categories. What percentage of patients are widowed? [Use R as a calculator to get the percentage] b) Create a subset of data that includes all observations for patients that are married. Include a call to g1 imps e to show the summary of the data. c) Of the married patients, what percentage are male? [Add a line of code to get this number]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
