Bob
Bob

Reputation: 10795

R seriation -> In max(criterion) : no non-missing arguments to max; returning -Inf

I have following dataset:

0101110
1010000
1010011
0101010
1000101

and want to seriate it. When I read it a call seriate function, like this:

matr <- read.table(...)
ser <- seriate(as.matrix(matr))

And I get an error:

Error in seriate.default(max(criterion) - criterion, method = "TSP", control = control) : 
  seriate not implemented for class 'numeric'.
In addition: Warning message:
In max(criterion) : no non-missing arguments to max; returning -Inf

What is the problem? I do not understand. I also read documentation and found nothing

Upvotes: 1

Views: 1111

Answers (1)

untitled
untitled

Reputation: 152

It seems that you have a problem in the way you read the data. The following works fine:

> library(seriation)
> m <- matrix(c(0,1,0,1,1,1,0,
+               1,0,1,0,0,0,0,
+               1,0,1,0,0,1,1,
+               0,1,0,1,0,1,0,
+               1,0,0,0,1,0,1), nrow=5, byrow=T )
> m
     [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]    0    1    0    1    1    1    0
[2,]    1    0    1    0    0    0    0
[3,]    1    0    1    0    0    1    1
[4,]    0    1    0    1    0    1    0
[5,]    1    0    0    0    1    0    1
> 
> seriate(m)
object of class ‘ser_permutation’, ‘list’
contains permutation vectors for 2-mode data

  vector length seriation method
1             5          BEA_TSP
2             7          BEA_TSP

However, if I cast the matrix as numeric, I get the same error that you got, which seems to indicate that you matrix is a numeric and that seriate reacts to a direct cast to matrix. With other words, ensure that your input is correct.

> m <- as.numeric(m)
> seriate(as.matrix(m))
Error in seriate.default(max(criterion) - criterion, method = "TSP", control = control) : 
  seriate not implemented for class 'numeric'.
In addition: Warning message:
In max(criterion) : no non-missing arguments to max; returning -Inf

Upvotes: 2

Related Questions