我目前正在阅读使用该软件包的文件readr.我们的想法是使用read_delim行读取行来查找非结构化数据文件中的最大列.代码输出存在parsing问题.我知道这些并将在导入后处理列类型.是否有办法关闭,problems()因为通常options(warn)不工作
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)
Run Code Online (Sandbox Code Playgroud)
我试图压制的控制台输出如下:
.See problems(...) for more details.
Warning: 11 parsing failures.
row col expected actual
1 1####4 valid date 1###8
Run Code Online (Sandbox Code Playgroud)