02 Jan 2018
It is more efficient to use dim(x)[1] to retrieve the number of rows rather than nrow(x) !
dim(x)[1]
nrow(x)
So to speed up your code, use dim(x)</code)>. Full explanation here:
dim(x)</code)>. Full explanation here:
https://www.r-bloggers.com/nrow-references-and-copies/
R
function