tfreq | R Documentation |
Constructs a frequency distribution table for a quantitative variable.
tfreq(data, limits = NULL, open = "right")
data |
The observations to construct the frequency distribution table. |
limits |
The class limits. |
open |
Where to leave the class limits open, |
If class limits are not specified, the Sturges' rule is used to calculate the
number of class intervals k
:
k \approx 1 + 3.3 \log n
Then, the left limit for the first class interval is set to the minimum value of the data,
the range r
is computed and the size of the class intervals is defined by:
c \approx \frac{r}{k}
where c
is rounded up with the same number of decimal places as the data.
It returns a frequency distribution table with columns for class mark, absolute and relative frequencies, and cumulative absolute and relative frequencies.
Raúl Eyzaguirre.
# Some random data from a normal population with mean 10 and standard deviation 1
set.seed(1)
datos <- rnorm(100, 10, 1)
# Data with 3 decimal places
datos <- round(datos, 3)
# A summary of the data
summary(datos)
# Frequency table with 6 specified limits
tfreq(datos, c(7, 8, 9, 10, 11, 12, 13))
# Default method
tfreq(datos)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.