最佳答案
我正在做一个 for 循环,为我的6000X180矩阵生成180个图形(每列1个图形) ,一些数据不符合我的标准,我得到了错误:
"Error in cut.default(x, breaks = bigbreak, include.lowest = T)
'breaks' are not unique".
I am fine with the error, I want the program to continue running the for loop, and give me a list of what columns made this error (as a variable containing column names maybe?).
下面是我的命令:
for (v in 2:180){
mypath=file.path("C:", "file1", (paste("graph",names(mydata[columnname]), ".pdf", sep="-")))
pdf(file=mypath)
mytitle = paste("anything")
myplotfunction(mydata[,columnnumber]) ## this function is defined previously in the program
dev.off()
}
注意: 我发现了很多关于 tryCatch 的帖子,但是没有一个对我有用(或者至少我不能正确地应用这个函数)。帮助文件也帮不上什么忙。
我会很感激你的帮助的,谢谢。