In the existing code, when the class(data) is a matrix, the condition of the if statement becomes (FALSE, TRUE), and in the case of data.frame, the condition of the if statement becomes (TRUE, FASLE), causing problems such as this issue.
Therefore, all is added to return TRUE when the condition of the if statement is (TRUE,TRUE), that is, when class(data) is not data.frame or matrix.
In the existing code, when the
class(data)
is a matrix, the condition of the if statement becomes(FALSE, TRUE)
, and in the case of data.frame, the condition of the if statement becomes(TRUE, FASLE)
, causing problems such as this issue.Therefore,
all
is added to returnTRUE
when the condition of the if statement is(TRUE,TRUE)
, that is, whenclass(data)
is not data.frame or matrix.