Re: [R] read.table question #only need to change column names

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Fri, 01 Apr 2011 10:50:05 -0400

On Apr 1, 2011, at 10:00 AM, hongsheng wu wrote:

> Hi all,
>
> I have a huge data set. All I want to do is to change the column
> names of
> the it. So if I use read.table, I can read the data in and change
> colnames
> and then write back, such as,
>
> t <- read.table("a.txt", header = T, sep = "\t")
>
> colnames(t)
>
> colnames(t) <- c("....) # new column names
>
> write.table(t, "a.txt", quote = F, sep = "\t", row.names = F,
> col.names = T)
>
> My question is that is there a better to do this without reading in
> and
> write out data entirely?

With an editor.

-- 

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 01 Apr 2011 - 14:54:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Apr 2011 - 15:00:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive