O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Obtaining some basic counts

Now that the data has been read, switch over to the console window. At the console prompt, enter the command table(df$Pain). This function will give you the raw counts of the number of patients who did or did not experience pain:

> table(df$Pain) 

This is the output that will appear in the console window:

 0  1  
35 25  

The prop.table function will supply you with the percentages of reported pain:

> prop.table(table(df$Pain))

This is the following output:

 
        0         1  
0.5833333 0.4166667  
 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required