next up previous
Next: Example 4 Up: Using read.table Previous: Example 2

Example 3

Example 3 is just like example 2, except now there is a line of text at the top of the file which says ``THIS IS FICTITIOUS DATA!''.
THIS IS FICTITIOUS DATA!

Dose                    Water           Relief
.1                      10              7
.2                      10              15
...
S-PLUS, if not warned, will interpret the first sentence as four columns: ``THIS'', ``IS'', ``FICTITIOUS'' and ``DATA!''. It will become confused when it reaches the data, which has three columns, not four. Tell S-PLUS to skip over the first two lines of the file (the text line and then the blank line that follows) so that the first line S-PLUS tries to read is the first line that we are actually interested in.

> ex3 <- read.table("example3", header=T, skip=2)



Brian Junker 2002-08-26