On Tue, 19 Jul 2005, wu sz wrote: > Thanks a lot! But DF[c(4,6)] <- DF[c(6,4)] seems to just exchange > the data, not the names. If exchanging the columns(both data and > names) needs two steps? > > DF[c(4,6)] <- DF[c(6,4)] > names(DF)[c(4,6)] <- names(DF)[c(6,4)]
Yes, it does. You did however say in your first message that you wanted to exchange the data, despite the subject line. As I asked before *PLEASE* do try to be precise in what you want to do. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html