Format:
In order to receive full credit for the practice problems, you need to submit an R script file. All the non-R codes need to be placed after the # signs. You also need to write your name and Assignment 2 on top of the page. Please make sure to include your name as part of the file name
To complete this assignment, you need to use what you’ve learned from this course. You
might not receive credits if you use the functions that are not used in this course.
You can only ask questions for clarification purposes on the Discussion Board. That is to
say, you can’t ask questions about how to answer a specific question or help you to debug
your program
This dataset contains SBP (Systolic Blood Pressure) measurements for each patient. Some patients were
measured once and some were measured more than once. The description of each variable is described
below:
The gender of each patient can be identified from the last field of the ID variable with ‘M’ for Male or ‘F’
for Female. The gender field can be in either upper or lower cases. Some of the IDs start with an ‘x’ and
some don’t. For example, ‘x13260M’ and ‘13260M’ refer to the same person.
Write a function, getMaxSBP, that takes one argument, which is the name of the input data. The function
returns a data frame that contains only one observation for each patient with the following variables:
newID : is created by using the numerical fields of the ID variable. For example, if ID is ‘x13260M’ or
‘13260M’, then NEWID is ‘13260’.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |