Message-ID: <7dh3o2d91ruct20ehguap5vvokeudlm292@4ax.com>
Date: 2006-12-14T22:05:20Z
From: Mike Prager
Subject: Better way to change the name of a column in a dataframe?
"Ben Fairbank" <BEN at SSANET.COM> wrote:
> [...] I want to correct or otherwise change the name of one of the
> columns, I can do so with
>
> > dimnames(frame)[[2]][which(dimnames(frame)[[2]]=="cmlo3")] <- "col3"
>
> This seems cumbersome and not very intuitive. How can one accomplish
> this more simply?
This is slightly simpler than what you had:
names(frame)[which(names(frame) == "cmlo3")] <- "col3"
There are probably better ways still.
--
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.