Learn R Programming

agricolae (version 1.0-4)

sturges.freq: Class intervals for a histogram, the rule of Sturges

Description

Number classes: k = 1 + 3.32 log10 (N).

Usage

sturges.freq(x)

Arguments

x
vector

Value

  • xNumeric

See Also

polygon.freq, table.freq, stat.freq, intervals.freq, graph.freq, join.freq, ojiva.freq, normal.freq

Examples

Run this code
library(agricolae)
data(natives)
attach(natives)
classes<-sturges.freq(size)
# information of the classes
classes
intervals <- classes$classes
#startgraph
# Histogram with the established classes
h1<-hist(size,breaks=intervals,freq=TRUE, col="yellow",axes=FALSE,
    xlim=c(0,0.12),main="",xlab="",ylab="")
axis(1,intervals,las=2)
axis(2,seq(0,400,50),las=2)
title(main="Histogram of frequency
Size of the tubercule of the Oca",
xlab="Size of the oca", ylab="Frequency")
#endgraph

Run the code above in your browser using DataLab