Learn R Programming

DescriptiveStats.OBeu (version 1.3.2)

ds.box: Boxplot Parameters of a numeric vector

Description

This function calculates the statistical measures needed to visualize the boxplot of a numeric vector.

Usage

ds.box(x, c = 1.5, c.width = 0.15 , out = TRUE, tojson = FALSE)

Arguments

x

The input numeric vector

c

Determines the length of the "whiskers" plot. If it is equal to zero or out=F, no outliers will be returned.

c.width

The width level is determined 0.15 times the square root of the size of the input vector

out

If TRUE the outliers will be computed at the selected "c" level (default is 1.5 times the Interquartile Range).

tojson

If TRUE the results are returned in json format

Value

Returns a list or a json file with the following components:

  • lo.whisker The extreme of the lower whisker

  • lo.hinge The lower "hinge"

  • median The median

  • up.hinge The upper "hinge"

  • up.whisker The extreme of the upper whisker

  • box.width The width of the box (default is 0.15 times the square root of the size of the vector)

  • lo.out The values of any data points which lie below the extreme of the lower whisker

  • up.out The values of any data points which lie above the extreme of the upper whisker

  • n The non-NA observations of the vector

Details

This function returns a list with the parameters needed to visualize a boxplot.

See Also

ds.analysis, open_spending.ds

Examples

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

# with vector as an input and the different parameters
vec <- as.vector(iris$Sepal.Width)
ds.box(vec, c = 3, c.width = 0.20 , out = FALSE, tojson = FALSE)

# OpenBudgets.eu Dataset Example:
amounts <- as.vector(Wuppertal_df$Amount)
ds.box(amounts, c = 1.5, c.width = 0.20, out = TRUE)

# }

Run the code above in your browser using DataLab