Re: [R] Bucketting data

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Mon 20 Jun 2005 - 23:02:19 EST

try this:

unique(cleandata[, 4])
length(unique(cleandata[, 4]))

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


> Hi,
>
> Am sure this is a trivial question but for some reason, haven't been
> able to figure it out.
>
> I want to bucket data in a vector, and then iterate over the
> buckets.
>
> Say the data set is:
>
>> cleandata[,4]
> [1] 26 26 26 26 26 26 26 26 26 26 26 26 61 61 61 61
> 61 61 61 61 61 61 61 89 89 89 89 89 89 89 180 180 180
> 180 362 544 544 544
> [39] 544 544 544 544 544 544 544
>
> This has the buckets:
>
> 26 61 89 180 362 544
>
> I'd like something which gives me a vector of these buckets, i.e.
> bucket(cleandata[,4])=vector of 26 61 89 180 362 544
>
> and length(bucket(cleandata[,4]))=6
>
> Thanks,
> Tolga
>
>
>
>
>
>
>
>
>
> ==============================================================================
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
>
> http://www.csfb.com/legal_terms/disclaimer_external_email.shtml
>
> ______________________________________________
> R-help@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
>



R-help@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 Received on Mon Jun 20 23:26:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:53 EST