as.data.frame is faster than data.frame
Along the lines of Chase’s answer, I usually use as.data.frame
to coerce the matrix to a data.frame:
m <- as.data.frame(matrix(0, ncol = 30, nrow = 2))
EDIT: speed test data.frame
vs. as.data.frame
|
|
Yes, it appears to be faster (by about 2 times).