Hi, is there any way I can change the column header in a data.frame? Thanks, ------------------------------------------------------------------- Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE ------------------------------------------------------------------- Eureka! -- Archimedes
If you data.frame is called df, then names(df) <- c(new names here) You can also do individual names names(df)[1] <- "new name for first column" HTH Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623>>> Rajarshi Guha <rxg218 at psu.edu> 10/20/03 02:36PM >>>Hi, is there any way I can change the column header in a data.frame? Thanks, ------------------------------------------------------------------- Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net> GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE ------------------------------------------------------------------- Eureka! -- Archimedes ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Consider the following: DF <- data.frame(a=1:2, b=3:4) names(DF) <- letters[1:2] DF dimnames(DF)[[2]][2] <- "z" DF This example illustrates two different ways to do what I understood from your question. Answered? spencer graves Rajarshi Guha wrote:>Hi, > is there any way I can change the column header in a data.frame? > >Thanks, > >------------------------------------------------------------------- >Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net> >GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE >------------------------------------------------------------------- >Eureka! >-- Archimedes > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >