我正在更新一个R-包,但我承认我已经四年没有使用R语言了,所以我忘记了很多事情.我把我的包上传给了cran,他们给我提供了一些警告和笔记.我设法解决了这些警告,但我的一行代码仍然有问题.
这行代码如下所示:
if (class(file) == "data.frame" || class(file2) == "data.frame")
CRAN返回以下问题:
Found if() conditions comparing class() to string:
File 'DFA/R/DFA.R': if (class(file) == "data.frame" || class(file2) == "data.frame") ...
File 'DFA/R/DFA.R': if (class(file) == "data.frame" || class(file2) == "data.frame") ...
File 'DFA/R/DFA.R': if (class(file) == "data.frame" || class(file2) == "data.frame") ...
File 'DFA/R/DFA.R': if (class(file) == "data.frame" || class(file2) == "data.frame" || class(file3) == "data.frame" || class(file4) == "data.frame") ...
Use inherits() (or maybe is()) instead.
有谁知道如何修改我的代码以使用Inherits()或is()而不会失go 原来的含义?