samedi 5 mars 2016

Logical commands with grepl to reduce data length

Data from several participants has been combined from several log files into one long table, bps. At present only one column is of interest, namely "Event.Type", which has values "Picture" or "Response". I want to produce a table of all "Picture" rows, ignoring all "Response"s. Unfortunately I can't get past the first step, i.e. to grepl all rows with the Event.Type value "Picture". Here is my initial attempt to produce a table of just the Picture rows:

for(i in 1:length(bps)) 
{ 
if (grepl("Picture", bps$Event.Type)) {
    tmp <- read.table(paste(datadir, bps[i], sep=''), sep = '\t') }
}
tmp

This gives the output "There were 15 warnings (display with warnings())"

Can anyone see what I'm doing wrong here? All help appreciated very much.

Aucun commentaire:

Enregistrer un commentaire