Skip to content
Prev 22141 / 63424 Next

colnames is slow for data.frames with implicit row.names

On Wed, 27 Sep 2006, Martin Morgan wrote:

            
So use names() and not colnames():

    rownames and colnames for matrices
    row.names and names for data frames.

All colnames assumes is that there is a dimnames method: this could be 
relevant for objects inheriting from "data.frame", but there is a price 
for generality.