merge_w_right: An internal function to that takes a response category found...

Description Usage Arguments Value Note See Also Examples

View source: R/collapse.R

Description

After sorting the response of v and putting them into a table, this function looks at the category in said table at position i and merges it with the category to the right at position i + 1.

Usage

1

Arguments

v

A vector of response categories.

i

An index of the to-be-collapsed category. i must range from 1 to the maximum number of response categories minus 1. For example, for response categories 1, 2, 3, 4, and 5, "5" is not possible because there is no place to the right. Thus, i can be 1, 2, 3, or 4.

Value

A vector of collapsed response data.

Note

This is intended as an internal function to the collapse() function. Use with care for other purposes.

See Also

collapse()

merge_w_left()

Examples

1
2
3
4
5
6
7
## Not run: 

sparse_vector <- c(1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5)
merge_w_right(sparse_vector, 2)


## End(Not run)

jameswgriffith/jamie documentation built on Dec. 20, 2021, 9:03 p.m.