Hi Whitney,

If I understood correctly, what you actually want is to construct a 2x2
table considering "smoking" and "retlevel". Perhaps something along the
lines of

with(yourdata, table(retlevel, smoking))

could give you some insights.  See ?table for more details.

HTH,
Jorge


On Mon, Mar 7, 2011 at 10:08 PM, Whitney Kistler <> wrote:

> I apologize in advance if this is posted all ready I have not been able to
> find any information about it.  I have this data frame and I want to sort
> smoking by retlevel.
>
>     Age Gender   BMI      Calories  Fat Fiber   Alc     retlevel
> Smoking
> 1    64  Female 18.87834   1828.0  63.4  14.7  0.0     Normal
> Non-Smoker
> 2    25  Female 20.64102   1517.4  59.1   5.9   0.0     Normal      Smoker
> 3    50  Female 20.40345   1902.9  72.9  35.4  7.3     Normal    Non-Smoker
> 4    32  Female 35.97525   3328.4 163.3  20.0  4.1      High         Smoker
> 5    43  Female 25.58279   2501.6 121.1  19.5  0.0      High         Smoker
> 6    39   Male   21.99912   1951.4   109.1   4.7   0.0     Normal
> Smoker
>
> To get an output like this.
>
> retlevel            Normal  High
> Smoking             2         2
> Non-smoker        1         1
>
> Thank you very much for your help.
>
> --
> Whitney Kistler M.S.
> Ph.D. Student
> Warnell School of Forestry and Natural Resources
> Southeastern Cooperative Wildlife Disease Study
> University of Georgia
> Athens, GA 30602
> wkist...@uga.edu
> cell:724-309-5298
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.
  • [R] Sorting Whitney Kistler
    • Re: [R] Sorting Jorge Ivan Velez

Reply via email to