Current smokers

Often, a data scientist has an objective in mind when performing data mining. So in this example, let's suppose we are interested in grouping patients who are smokers into age groups. Using the variable current_smoker, we can use the R table function and run the following code:

table(chapter4["current_smoker"]) 

This yields the following information:

From the results shown here, it seems like we have more non-smokers (5466) than smokers (528), at least in this file or population.

Next, what we'd like to see (that is, visualize) is the smoker patients in our population organized into (or by) age groups. To do this, a logical ...

Get Statistics for Data Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.