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

Reading the data

We will use the read.table with the text= option to read the raw data inline, that is, without the need to first create an external file. This method is useful for analysis in which you are copying and pasting data from another source, for example, a spreadsheet:

 df <- read.table(text = 'Treatment Gender Age Duration Pain P F 68 1 0 P M 66 26 1 A F 71 12 0 A M 71 17 1 B F 66 12 0 A F 64 17 0 P M 70 1 1 A F 64 30 0 B F 78 1 0 B M 75 30 1 A M 70 12 0 B M 70 1 0 P M 78 12 1 P M 66 4 1 A M 78 15 1 P F 72 27 0 B F 65 7 0 P M 67 17 1 P F 67 1 1 A F 74 1 0 B M 74 16 0 B F 67 28 0 B F 72 50 0 A F 63 27 0 A M 62 42 0 P M 74 4 0 B M 66 19 0 A M 70 28 0 P M 83 1 1 P M 77 29 1 A F 69 12 0 B M 67 23 0 B M 77 1 1 P F 65 29 0 B M 75 21 ...

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