Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

collapse

Reduces a vector to a frequency vector


Description

This function reduces a vector to a frequency vector.

Usage

collapse(D,pos=FALSE)

Arguments

D

Vector

pos

Optional: position of categories

Details

This function reduces a vector to a frequency vector. This function is similar to the way table summarizes vectors, but this function can deal with categories of frequency 0 (if the argument pos is specified). Here we assume a vector with an entry for each individual (sorted in any way). Each entry states the position of an individual. When the number of positions is naturally limited, such as when categorical positions are used, frequency vectors can summarize this information: how many individuals have position 1, how many individuals have position 2, etc. A frequency vector has an entry for each position in the population (sorted in ascending order). Each entry states the number of individuals in the population with this position.

The argument pos is required if certain positions do not occur in the population. For example, if we have positions on a 7-point scale, and position 3 never occurs in the population, the argument pos must be specified. In this case, our argument may be pos=1:7. We can also use categories more generally, as in c(-3,-1,0,.5,1,2,5). Specifying the positions of categories when all positions actually occur in the population has no side-effects.

Value

A frequency vector

Author(s)

Didier Ruedin

See Also


agrmt

Calculate Concentration and Dispersion in Ordered Rating Scales

v1.42.4
MIT + file LICENSE
Authors
Didier Ruedin [aut, cre] Clem Aeppli [ctb]
Initial release
2020-08-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.