What is the fastest way to convert a matrix like the following to a data.table?
mat <- matrix(1:9, nrow = 3)
1 2 3
4 5 6
7 8 9
I can convert this to a data.table with the code below
setDT(data.frame(mat))[]
But is this the fastest way? Can we do this without first converting it to a data.frame?