[R] simple table ordering question

jim holtman jholtman at gmail.com
Sun May 6 02:54:32 CEST 2007


Convert them to factors in which you specify the order:

> mytable<-factor(c(rep("Disagree",37),rep("Agree",64)), levels=c("Disagree","Agree"))
> table(mytable)
mytable
Disagree    Agree
      37       64


On 5/5/07, AP05 <jeffmiller at alphapoint05.net> wrote:
> Hi all,
>
> I'm sure this is simple but I don't get it.
>
> I have a table
>
> mytable<-c(rep("Disagree",37),rep("Agree",64))
> table(mytable)
>
> this gives me
> Agree    Disagree
> 64        37
>
> but I didn't ask for it to be in alphabetic order.
>
> How can I get it in original order?
>
> Disagree    Agree
> 37            64
>
> Thanks,
> Jeff
>
>
>
>
> Jeffrey. M. Miller, PhD
>
> Statistics & Data Anaysis Consultant
>
> CEO - AlphaPoint05, Inc
>
>
> <http://maps.yahoo.com/py/maps.py?Pyt=Tmap&addr=2792+SE+27th+Ave&csz=Gainesv
> ille%2C+FL+32641&country=us> 2792 SE 27th Ave
> Gainesville, FL 32641
>  <mailto:jeffmiller at alphapoint05.net> jeffmiller at alphapoint05.net
>  <http://www.alphapoint05.net/> www.alphapoint05.net
> mobile: 352-359-6611
>
>
>
> ************************************************************************
> **********************************
> This E-mail message is confidential, intended only for the named
> recipient(s) above and may contain information that is privileged,
> confidential or exempt from disclosure under applicable law.
> No part of this E-Mail should be reproduced, adapted or transmitted
> without the written consent of the data proprietor and/or president of
> AlphaPoint05, Inc. Violation will result in fines and/or
> imprisonment as determined by federal/state judiciary verdict.
> If you receive it in error, please let us know by reply E-mail, delete
> it from your system and destroy any copies. Thank you.
> ************************************************************************
> **********************************
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list