See ?hist For example hist(rnorm(100),plot=F,breaks=-3:3)$counts Regards Wayne -----Original Message----- From: Silvia Kirkman [mailto:silviakirkman@yahoo.com] Sent: 21 June 2004 14:01 To: r-help@stat.math.ethz.ch Subject: [R] frequencies Hi I have a set of fish lengths (cm) which I'd like to have divided into bins as specified by myself. I want to classify my bins as: 0<=x<0.5 0.5<=x<1 1<=x<1.5 1.5<=x<2 and so on... I'd like the frequencies to be given as a vector because I need to use these values for further analysis. Please can someone help me with this. I can't find a command in R that allows one to do this. Many thanks. Silvia Kirkman ______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html KSS Ltd Seventh Floor St James's Buildings 79 Oxford Street Manchester M1 6SS England Company Registration Number 2800886 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305 mailto:kssg@kssg.com http://www.kssg.com The information in this Internet email is confidential and m...{{dropped}}
Hi I have a set of fish lengths (cm) which I'd like to have divided into bins as specified by myself. I want to classify my bins as: 0<=x<0.5 0.5<=x<1 1<=x<1.5 1.5<=x<2 and so on... I'd like the frequencies to be given as a vector because I need to use these values for further analysis. Please can someone help me with this. I can't find a command in R that allows one to do this. Many thanks. Silvia Kirkman
You want the function cut(), followed by table(). Bendix ---------------------- Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2 DK-2820 Gentofte Denmark tel: +45 44 43 87 38 mob: +45 30 75 87 38 fax: +45 44 43 07 06 bxc at steno.dk www.biostat.ku.dk/~bxc ----------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Silvia Kirkman > Sent: Monday, June 21, 2004 4:01 PM > To: r-help at stat.math.ethz.ch > Subject: [R] frequencies > > > Hi > > I have a set of fish lengths (cm) which I'd like to > have divided into bins as specified by myself. I want > to classify my bins as: > > 0<=x<0.5 > 0.5<=x<1 > 1<=x<1.5 > 1.5<=x<2 > and so on... > > I'd like the frequencies to be given as a vector > because I need to use these values for further > analysis. > > Please can someone help me with this. I can't find a > command in R that allows one to do this. > > Many thanks. > > Silvia Kirkman > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help > PLEASE > do read the posting guide! > http://www.R-project.org/posting-guide.html >