课程: Descriptive Healthcare Analytics in R

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Solution: Make a categorical variable from a continuous one

Solution: Make a categorical variable from a continuous one - R教程

课程: Descriptive Healthcare Analytics in R

Solution: Make a categorical variable from a continuous one

(upbeat music) - [Instructor] Okay, how did you do on the challenge? Were you able to make the variable BPGrp? I'll show you what I did for the solution. So above the big comment, we have the code we talked about earlier. Actually, let's run that code now so we are up to date. Let me close this histogram so we can see our code. As I said, next we have this big comment just to remind you of the empirical cut points from the AHA, which were the parameters for this challenge. Below that, we get to the code I made to create the categorical variable BPGrp in the data frame BP_A. See these five lines of code? In the first line, I create the variable BPGrp, in the data frame, BP_A and I code the entire variable as nine, meaning don't know in my mind. Next, in the next line, I update that value. As you can see in the brackets, the criteria for our updating the variables value is if BPXOSY1, meaning the systolic blood pressure measurement is less than 120. Remember how that is classified as…

内容