Learn R Programming

DescriptiveStats.OBeu (version 1.3.2)

ds.hist: Histogram breaks and frequencies

Description

This function computes the histogram parameters of the numeric input vector. The default for breaks is the value resulted from Sturges algorithm.

Usage

ds.hist(x, breaks = "Sturges", tojson = FALSE)

Arguments

x

The input numeric vector, matrix or data frame

breaks

The method or the number of classes for the histogram

tojson

If TRUE the results are returned in json format, default returns a list

Value

A list or json file with the following components:

  • cuts The boundaries of the histogram classes

  • density The density of each histogram class

  • normal.curve.x Abscissa of the normal curve

  • normal.curve.y Ordinate of the normal curve

  • fit.line.x Abscissa of the data density curve

  • fit.line.y Ordinate of the data density curve

  • mean The average value of the input vector

  • median The median value of the input data

Details

The possible values for breaks are Sturges see nclass.Sturges, Scott see nclass.scott and FD or Freedman Diaconis nclass.FD which are in package grDevices.

See Also

ds.analysis, open_spending.ds

Examples

Run this code
# NOT RUN {
# with a vector as an input and the defaults parameters
vec <- as.vector(iris$Sepal.Width)
ds.hist(vec)

# OpenBudgets.eu Dataset Example:
ds.hist(Wuppertal_df$Amount, tojson = TRUE)

# }

Run the code above in your browser using DataLab