Package base version 4.3.2
requireNamespace(package, ..., quietly = FALSE)
参数【package】:字符串,表示要加载的软件包/名称空间(NAMESPACE)。
参数【quietly】:逻辑值;是否应取消进度和错误信息?
参数【quietly】的默认值 FALSE 表示在控制台输出检查过程和信息;将此参数的值设置为 TRUE,可以隐藏检查过程的信息在控制台上的输出。
requireNamespace 成功则返回 TRUE,失败则返回 FALSE。
if (requireNamespace("rWCVPdata")){
print("succeed and with process")
}
if (requireNamespace("rWCVPdata", quietly = TRUE)){
print("succeed and without process")
}
if (!requireNamespace("rWCVPd")){
print("failed and with process")
}
if (!requireNamespace("rWCVPd", quietly = TRUE)){
print("failed and without process")
}
[1] "succeed and with process"
[1] "succeed and without process"
载入需要的名字空间:rWCVPd
Failed with error: ‘不存在叫‘rWCVPd’这个名字的程辑包’
[1] "failed and with process"
[1] "failed and without process"