>>>>> Steve Bronder <sbron...@stevebronder.com> >>>>> on Thu, 7 May 2015 11:49:49 -0400 writes:
> Is it possible to replace c() with .subset()? It would be possible, but I think "entirely" wrong. .subset() is documented to be an internal function not to be used "lightly" and more to the point it is documented to *NOT* dispatch at all. If you read and understood what Peter and Luke wrote, you'd not special case here: diag() should not work only for pure matrices, but for all "matrix-like" objects for which ``the usual methods'' work, such as as.vector(.), c(.) That's why there has been the c(.) in there. You can always make code faster if you write the code so it only has to work in one special case .. and work there very fast. > Example below > #### > #### > library(microbenchmark) ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel