?is.matrix says:
'is.matrix' returns 'TRUE' if 'x' is a vector and has a "dim" attribute of length 2) and "FALSE" otherwise.
Your object is a list with the dim attribute. A list is a type of vector (although it is not an atomic type that most people think of as vectors), therefore is.matrix returns TRUE . For instance:
> l <- as.list(1:10) > dim(l) <- c(10,1) > is.matrix(l) [1] TRUE
To convert mymatrix to an atomic matrix, you need to do something like this:
mymatrix2 <- unlist(mymatrix, use.names=FALSE) dim(mymatrix2) <- dim(mymatrix)
source share