I will try to answer your question based on the information you gave. Fundamentally the problem is data, particularly in a_heterophylla_NAY_SIN
, the error triggers when scatterplotMatrix()
invokes internally pairs()
assigning the x
parameter to your a_heterophylla_NAY_SIN
object, if you see the documentation:
x: the coordinates of points given as numeric columns of a matrix or
data frame Logical and factor columns are converted to numeric in the
same way that data.matrix does.
That is, a matrix or a dataframe is expected and fundamentally all values must be "mapped" to numerical values. Reviewing the code of pairs()
, we see:
if (!is.matrix(x)) {
x <- as.data.frame(x)
for(i in seq_along(names(x))) {
if(is.factor(x[[i]]) || is.logical(x[[i]]))
x[[i]] <- as.numeric(x[[i]])
if(!is.numeric(unclass(x[[i]])))
stop("non-numeric argument to 'pairs'")
}
} else if (!is.numeric(x)) stop("non-numeric argument to 'pairs'")
That is, o a_heterophylla_NAY_SIN
is a non-numeric matrix or an object that is still mapped as a dataframe, some of its columns are not numeric. The solution would then go through "normalize" a_heterophylla_NAY_SIN
, and eventually convert any non-numeric value into a Factor, so that it can be processed correctly.