merge_w_left: 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 left 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 2 to the maximum number of response categories. For example, for response categories 1, 2, 3, 4, and 5, "1" is not possible because there is no place to the left. Thus, i can be 2, 3, 4, or 5.

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_right()

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_left(sparse_vector, 2)


## End(Not run)

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