From mtmorgan at fhcrc.org  Wed Sep 27 15:13:56 2006
From: mtmorgan at fhcrc.org (Martin Morgan)
Date: Wed, 27 Sep 2006 06:13:56 -0700
Subject: [Rd] colnames is slow for data.frames with implicit row.names
Message-ID: <6phu02tmoyz.fsf@gopher4.fhcrc.org>

colnames on a data.frame with implicit row.names

> df <- data.frame(x=1:6000000)

is slow

> system.time(colnames(df))
[1] 21.655  0.327 21.987  0.000  0.000
> system.time(names(df))
[1] 0 0 0 0 0

because colnames calls dimnames calls row.names.data.frame calls
as.character on the implicit row.names.
-- 
Martin T. Morgan
Bioconductor / Computational Biology
http://bioconductor.org




[Rd] colnames is slow for data.frames with implicit row.names
Martin Morgan