On 28/07/2009, at 9:45 AM, Mark Na wrote:
> Hi R-helpers,
>
> I have written this line of code:
>
>> data<-cbind(data[,1],data[,2:6],data[,18],data[,7:17])
>
> to reorder the columns of my dataframe, but I'm losing the column
> names of
> my 1st and 18th columns (they are now named data[,1] and data[,18]
> respectively).
>
> Can I use cbind to do this (without losing my column names) or is
> there
> another way?
Just do
data <- data[,c(1:6,18,7:17)]
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}