My question is: Suppose you have computed an algorithm that gives the number of iterations and you would like to print the number of iterations out. But the output always many d
If you have a numeric matrix you wish to coerce to an integer matrix (e.g., you are creating a set of dummy variables from a factor), as.integer(matrix_object)
will coerce the matrix to a vector, which is not what you want. Instead, you can use storage.mode(matrix_object) <- "integer"
to maintain the matrix form.