histdata {exams.forge} | R Documentation |
Histogram Data
Description
Returns data for a histogram. Calls internally hist(..., plot=FALSE)
.
-
mean
returns the mean of the data. -
quantile
andmedian
return the quantile(s) or median with an attributepos
, the class number of the quantile(s), or the median.
Usage
histdata(x, breaks = "Sturges", probs = seq(0, 1, 0.25), ...)
## S3 method for class 'histogram'
quantile(x, probs = seq(0, 1, 0.25), ...)
## S3 method for class 'histogram'
median(x, ...)
## S3 method for class 'histogram'
mean(x, ...)
dhist(x, breaks = "Sturges", probs = seq(0, 1, 0.25), ...)
Arguments
x |
numeric data or histogram data |
breaks |
one of:
In the last three cases the number is a suggestion only; as the
breakpoints will be set to |
probs |
numeric: probabilities to use if |
... |
further parameters used in graphics::hist |
Value
Like in graphics::hist, but with this additional list of elements:
-
lower
lower class borders, -
upper
upper class borders, -
width
class widths, -
relfreq
the relative class frequency, -
cumfbrk
the cumulated relative frequency of thebreaks
, -
maxdens
the indices of the maximaldensity
values, -
maxcount
the indices of the maximalcount
values -
x
the original finite data, and -
class
the class number for each value inx
.
Examples
#1
x <- seq(0, 1, by=0.25)
print(hist(x, plot=FALSE))
histdata(x)
#2
x <- seq(0, 1, by=0.25)
print(hist(x, x, plot=FALSE))
histdata(x, x)
#3
print(hist(x, x, right=FALSE, plot=FALSE))
histdata(x, x, right=FALSE)