You might want to experiment with:

ql <- cut( fam$I[fam$I>0], breaks = quantile( fam$I[fam$I>0], type=1) , right=FALSE)
 levels(ql) <- c("1stQ","2ndQ","3rdQ","4thQ")
 ql


cut() returns a factor. If you accept the default for the right parameter in cut, you will be pulling your hair out when dealig with a discrete variable.

On Jun 17, 2009, at 6:24 PM, Germán Bonilla wrote:

Hi all,

I've got a simple contingency table produced with table(), and the upper and
lower quartiles (quantile25 and quantile75) for the same dataset.
Is there a function that tells me in which category does the value of the
quartile falls into?

I cannot quite parse this sentence. See if the example gives a meaningful result with your data, and read the help pages for quantile.


for example:

tabsp <- table(fam$I[fam$I>0])

1 3 6
6 1 1

and for the cumulative frequency distribution

tabcum <- cumsum(tabsp)

1 3 6
6 7 8

so, If my lower quartile is "2", I can visually determine that it falls into class/category "1" with 6 observations. Is there a function that performs
this determination?

Thanks.

Germán Bonilla
I. Ecol. UNAM

        [[alternative HTML version deleted]]

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
[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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to