From the course: Descriptive Healthcare Analytics in R

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Generating the smoking variables

Generating the smoking variables - R Tutorial

From the course: Descriptive Healthcare Analytics in R

Start my 1-month free trial

Generating the smoking variables

- [Instructor] First we will review the data dictionary for the different smoking variables we need to make. This was a rather complicated variable. Next I will go through the code needed to make the smoking variables. We will make and check the variables. Okay, let's go to our data dictionary. Let's look at SMOKDAY2, our smoking variable. We don't like that these unknowns need to be collapsed. Also, Every Days and Some Days need to be collapsed. Those will both be one in the new variable. So we need to make a grouping variable first which we didn't have to do with age. That will be called SMOKGRP. I'll show you how. But also, don't forget the SMOKE100 tab. We have a bunch of never smokers in there, and we need to make sure that they show up as non-smokers rather than unknown in the grouping variable. Let's scroll down a little and look at the smoking code. First before we get to the grouping variable, let's get our NEVERSMK variable going. Remember if they said two, or No, to smoking…

Contents