Peter, Thank you, I made a mistake in my previous email. What I mean is:
data.new[,"G1"] <- (data.old[,"XG1"] + data.old[,"YG1"])/2 Does your way have effects on data? or only have effects on those column names? I tried on my data and get a list of numbers. Can I rearrange the order of columns of data.frame by your way? 2006/5/31, Peter Alspach <[EMAIL PROTECTED]>: > > Wei-wei > > yourNames > [1] "XG1" "YG1" "XEST" "YEST" "XNOEMP1" "XNOEMP2" > [7] "YNOEMP1" "YNOEMP2" "XBUS10" "XBUS10A" "XBUS10B" "XBUS10C" > [13] "YBUS10" "YBUS10A" "YBUS10B" "YBUS10C" "XOWNBUS" "XSELFEST" > [19] "YOWNBUS" "YSELFEST" > yourNames[order(substring(yourNames,2), substring(yourNames, 1,1))] > [1] "XBUS10" "YBUS10" "XBUS10A" "YBUS10A" "XBUS10B" "YBUS10B" > [7] "XBUS10C" "YBUS10C" "XEST" "YEST" "XG1" "YG1" > [13] "XNOEMP1" "YNOEMP1" "XNOEMP2" "YNOEMP2" "XOWNBUS" "YOWNBUS" > [19] "XSELFEST" "YSELFEST" > > gives an idea of what I mean ....... > > Peter Alspach > > > > ______________________________________________________ > > The contents of this e-mail are privileged and/or confidential to the > named recipient and are not to be used by any other person and/or > organisation. If you have received this e-mail in error, please notify > the sender and delete all material pertaining to this e-mail. > ______________________________________________________ > ______________________________________________ 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