I have some functions which take very specific matrices with specific information loaded in using another function I've made. Currently the matrices the function accepts are the normal R matrix type. However I'd like to assign them as a different type or class so as to achieve easy input checking so the user can't throw any matrix into the function.

I figured the S3 method would be easy after seeing a few examples on the net:

```
mat1 <- matrix(c(1:10),ncol=5)

colnames(mat1) <- c("ONE","TWO","THREE","FOUR","FIVE")

as.sdpmgdna <- function(x) {
  class(x) <- "sdpmgdna"
  return(x)
}

mat2 <- as.sdpmgdna(mat1)

```

This appears to work in so far as if I return mat2 I see a matrix, and if I call it via indecies mat2[1,2] I get the right values I should get. However I can't be sure some things have changed - it is now described as sdpmgdna[10] i.e. it seems to ignore it has 2 dimensions, although doing the above and printing mat2 to screen shows it clearly does have 2 dimensions. Another odd thing is if I do `colnames(mat2)` they are returned. However if I try to find the colname of an individual column e.g. `colname(mat2[,4])` then the value returned is `NULL`. Can anyone explain why this is or what I should do - I really want it to basically be a matrix, but because the functions require it to be very specific in terms of a matrix of what and how big, defining it as another class would make error and input checking so much easier - and allow me to use the methods mechanism of R so all my custom plotting functions could just be methods of plot().