运行R脚本时创建警告日志文件
我想为R脚本创建警告/错误日志。运行R脚本时创建警告日志文件,r,warnings,sink,R,Warnings,Sink,我想为R脚本创建警告/错误日志。 请参见以下示例: setwd(tempdir()) zz <- file("all.Rout", open="wt") sink(zz, type="message") for (i in 1:30){ log(i-50) } sink(type="message") close(zz) setwd(tempdir()) zz尝试选项(warn=1) 从?选项: 'warn': se
请参见以下示例:
setwd(tempdir())
zz <- file("all.Rout", open="wt")
sink(zz, type="message")
for (i in 1:30){
log(i-50)
}
sink(type="message")
close(zz)
setwd(tempdir())
zz尝试选项(warn=1)
从?选项:
'warn': sets the handling of warning messages. If 'warn' is
negative all warnings are ignored. If 'warn' is zero (the
default) warnings are stored until the top-level function
returns. If 10 or fewer warnings were signalled they will be
printed otherwise a message saying how many were signalled.
An object called 'last.warning' is created and can be printed
through the function 'warnings'. If 'warn' is one, warnings
are printed as they occur. If 'warn' is two or larger all
warnings are turned into errors.
完美的谢谢:)