- the presentation files are text files so our choice would be the read table function
- there are arguments to specify the behaviour of the function, here some of them:
- first of all file - the name of the which the data are to be read from
- header - logical value indicating whether the file contains the names of the variables as its first line
- sep - the field separator
- dec - character used in the file as decimal point
- na.strings - a character vector of strings interpreted as missing values
- to set the parameters we need to have a look at the file so
- file is the \textit{pre001.txt} in the session1data directory
- there is a header (but not in the first line) so header=T
- we find the tabulator as separator so \texttt{sep='\textbackslash{}t'}
- there are no decimal points in the file so we ommit dec
- at first glance we do not see any obvious missing values
- because our data starts with the fourth line we use skip=3 to skip the first three lines
- so we have
1 x <- read.table(file = "session1data/pre001.txt",
2 sep = "\t",
3 header = T,
4 skip = 3)
5 > head(x)
6 Subject Trial Event.Type Code Time TTime Uncertainty Duration
7 1 NA NA NA NA NA
8 2 PRE001 1 Response 3 104975 114605 1 NA
9 3 PRE001 2 Response 3 117581 12411 1 NA
10 4 PRE001 4 Picture B1 T1 125765 0 1 5008
11 5 PRE001 5 Picture RO09.jpg 130773 0 391 38181
12 6 PRE001 6 Sound RO09.wav 131273 0 2 NA