Learn R Programming

sn (version 2.1.1)

spread.grouped: Spreading grouped data over intervals

Description

Assuming that counts represents the frequencies of observations falling into intervals identified by breaks, the function returns a vector of values obtained by uniformly spreading each group of data over the pertaining interval.

Usage

spread.grouped(breaks, counts, shift = "centre")

Value

A numeric vector of length sum(counts) of values within range(breaks).

Arguments

breaks

A numeric vector of strictly increasing finite values which identify a set of contiguous intervals on the real line.

counts

A vector of non-negative integers representing the number of observations falling in the intervals specified by breaks; it is then required that length(counts)+1=length(breaks).

shift

a character string which regulates the positioning of the constructed points within a given interval, with possible values "left", "center" (default choice) and "right", possibly abbreviated.

Author

Adelchi Azzalini

See Also

fitdistr.grouped

Examples

Run this code
breaks <- c(10, 12, 15, 20)
counts <- c(3, 2, 4)
spread.grouped(breaks, counts)
spread.grouped(breaks, counts, "l")

Run the code above in your browser using DataLab