This should work:
dat.file <- paste("C:\\test.csv")
# use readLines() to get file line-by-line
dat.in <- readLines(dat.file)
# filter out "error"
dat.in <- dat.in[grep("error", dat.in, invert=TRUE)]
# turn structure into a string we can pass to textConnection
read.csv(textConnection(paste(dat.in, collapse="\n")), header=TRUE)
If you were on a Linux/OS X system, I'd have had you pipe the file through the system grep
, but, sigh, #Windows.