On 3/10/2007, at 5:10 PM, Christos Hatzis wrote:

> Would
>
> levels(fff) <- c("A","S","U")
>
> not work?

        Well, not quite.  This would scramble the levels.  The levels of the  
original fff are
        c("Unit","Achieved","Scholarship")  --- i.e. they are ***not*** in  
alphabetical order.

        But your suggestion modified to

                levels(fff) <- c("U","A","S")

        does indeed seem to work.

        I had a clear and distinct recollection of having tried something  
like this previously
        and getting a factor consisting entirely of NAs (since none of the  
assigned levels
        matched any of the existing levels).  But my clear and distinct  
recollection appears
        to have been a load of dingos' kidneys.

        I now believe that what I was recollecting was the fact that

                fff <- factor(fff,levels=c("U","A","S"))

        gives a factor consisting of nothing but NAs.  Subtly (???) different.

        I have a nagging feeling that there is some risk associated with  
your suggestion,
        as compared with Peter Dalgaard's.  But I can't see what that risk  
would actually be.

                                cheers,

                                        Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confidenti...{{dropped}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to