s-news
[Top] [All Lists]

Re: How to change the column name from command line?

To: "Khan, Sohail" <khan@cshl.edu>
Subject: Re: How to change the column name from command line?
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Thu, 07 Jul 2005 15:26:12 -0500
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <C8696843AE995F4EA4CDC3E2B83482A90DDCCF@mailbox02.cshl.edu>
Organization: PDF Solutions, Inc.
References: <C8696843AE995F4EA4CDC3E2B83482A90DDCCF@mailbox02.cshl.edu>
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)


Khan, Sohail wrote:
Dear members,

Is there a way to change the column name of a data frame from the command line? Thanks in advance


Try:

x <- data.frame(old.name = 1, other.name = 2)
names(x)[1] <- "new.name"

--sundar

<Prev in Thread] Current Thread [Next in Thread>