For all the coding tasks below, create a single R Script and save it with the file name format {MacProb1_familyname_firstname.R}
The data below is taken from the Regional Situationer Report of DOH Region XI as of September 8, 2020.
1
Using the data in Table 1 above, do the following:
Create a variable in R that contains the total number of Active Case and assign it to “total”
Create a numeric vector in R that contains the distribution of COVID-19 cases { 326, 67, 7, 1} and assign them to “dist_Cases” . Assign their status category {asymptomatic, mild, severe and critical) as names of the vector elements.
Using the created numeric vector in part I.2, select the values representing the mild and asymptomatic cases and assign them to “mild_2_asymtomatic”.
In the data province with new cases, we only have Davao City and Davao del Norte. Davao del Sur, Davao Oriental, Davao de Oro and Davao Occidental have no new COVID-19 cases. Create an object in R (numeric vector) and assign it to “newcases”. Include those provinces with no new cases.
Print the object “newcases” by selecting only the provinces with new COVID-19 cases.
The data below is taken from the Regional Situationer Report of DOH Region XI as of September 8, 2020.
2
Using the data in Table 2 above, do the following tasks:
Create an R object or matrix named “breakdown” that will hold the COVID-19 total active cases, total deaths, and total recoveries for the different provinces and city in Davao Region. Assign appropriate column names {Total Active, Total Deaths, Total Recoveries} and row names {names of provinces and city} to the matrix.
Get a subset of the matrix “breakdown” by selecting only the data for Davao City.
Get a subset of the matrix by selecting those whose number of deaths is below 4.
For the whole Davao Region get the total number of active cases, total deaths and total recoveries as of September 8, 2020, and assign it to the object “sumDavao” .
Create a data frame using the same data presented in Table 1 and 2 above and assign it to “covid_data”. Note: Some information in Table 1 do not have provincial/city breakdowns, hence, you cannot include them in the data frame.
Insert a column to the data frame “covid_data” by adding a column for new cases [TRUE/FALSE].
You are given a sample of 50 COVID-19 cases based on the records release by DOH. The data in excel format is available in the UVE as an attachment to machine problem 1
Use this data to perform the following:
import the dataset to R.
Convert the data into a tibble data frame and assign it to “covid_raw”.
Create a new data frame “above_60” by selecting the patients who are above 60 years old.
Extract the patients who is above 60 years old who already recovered from COVID-19. Assign the new data frame to “recovery_60”.
Create a new data frame “no_signs” that contains the asymtomatic patients or patients with NA values for the listed symptoms for COVID-19.