>>>>> "UweL" == Uwe Ligges <[EMAIL PROTECTED]>
>>>>>     on Thu, 01 Dec 2005 08:37:37 +0100 writes:

    UweL> [EMAIL PROTECTED] wrote:
    >> hi all,
    >> 
    >> I load a table with headers that enable me to acces it by the column 
names:
    >> 
    >> tab<-read.table("blob/data.dat",h=T)
    >> attach(tab)
    >> 
    >> everythings are OK, but i try to sort this table against one of his 
column like this:
    >> 
    >> tab<-tab[order(tab$IndexUI),];
    >> 
    >> It is still ok, the table is sorted, if i type "tab" i see a sorted 
table.
    >> 
    >> but, when i call the column by their names, it appears that the column 
isn't sorted...
    >> 
    >> I believe that, is there a solution to attach column names another time, 
to reflect the effect of sorting this table?
    >> 
    >> thks all for your answers

    UweL> see ?colnames

eehm, that won't really help here.

The problem is that Guillaume
- first attach()ed the data frame
- then changed the data frame itself,
- and then erronously assumed that the *attached* data would change.

In general, we nowadays recommend quite often against using attach()
but rather use the 'data = ' argument where applicable and use
with( <data frame> , <......> ) 
otherwise.

Martin Maechler, ETH Zurich

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to