From real data to distributionH.
data2hist(
  data,
  algo = "histogram",
  type = "combined",
  qua = 10,
  breaks = numeric(0),
  epsilon = 0.01
)A distributionH object, i.e. a distribution.
a set of numeric values.
(optional) a string. Default is "histogram", i.e. the function "histogram"
defined in the histogram  package. 
 If "base"
the hist function is used. 
"FixedQuantiles" computes the histogram using as breaks a fixed number of quantiles.
"ManualBreaks" computes a histogram where braks are provided as a vector of values.
"PolyLine" computes a histogram using a piecewise linear approximation of the empirical
cumulative distribution function using the "Ramer-Douglas-Peucker algorithm",
 https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm.
 An epsilon parameter is required.
 The data are scaled in order to have a standard deviation equal to one.
(optional) a string. Default is "combined" and generates
a histogram having regularly spaced breaks (i.e., equi-width bins) and
irregularly spaced ones. The choice is done accordingly with the penalization method described in
histogram. "regular" returns equi-width binned histograms, "irregular" returns
a histogram without equi-width histograms.
a positive integer to provide if algo="FixedQuantiles" is chosen. Default=10.
a vector of values to provide if  algo="ManualBreaks" is chosen.
a number between 0 and 1 to provide if algo="PolyLine" is chosen. Default=0.01.
histogram function
data <- rnorm(n = 1000, mean = 2, sd = 3)
mydist <- data2hist(data)
plot(mydist)
Run the code above in your browser using DataLab