I am currently reading a file using the readr package. The idea is to use read_delim to read in a row for a row to find the maximum columns in my unstructured data file. The code displays parsing problems. I know about this and will deal with the type of column after import. Is there a way to disable problems() since regular options(warn) doesn't work
i=1 max_col <- 0 options(warn = -1) while(i != "stop") { n_col<- ncol(read_delim("file.txt", n_max = 1, skip = i, delim="\t")) if(n_col > max_col) { max_col <- n_col print(max_col) } i <- i+1 if(n_col==0) i<-"stop" } options(warn = 0)
The console output that I am trying to suppress is as follows:
.See problems(...) for more details. Warning: 11 parsing failures. row col expected actual 1 1####4 valid date 1###8
r readr
Hanjo Jo'burg Odendaal
source share