unique_pairs: Extract Only Unique Pairs of Collocating Words in...

Description Usage Arguments Value See Also Examples

View source: R/unique_pairs.R

Description

tidy_colo_dtm utilizes the entire matrix to generate the tidied data.frame. This means that the upper and lower triangles are used redundantly. This function eliminates this redundancy by dropping one set of the pairs from a tidied data.frame.

Usage

1
2
3
4
5
6
7
unique_pairs(x, col1 = "term_1", col2 = "term_2", ...)

## Default S3 method:
unique_pairs(x, col1 = "term_1", col2 = "term_2", ...)

## S3 method for class 'data.table'
unique_pairs(x, col1 = "term_1", col2 = "term_2", ...)

Arguments

x

A data.frame with two columns that contain redundant pairs.

col1

A string naming column 1.

col2

A string naming column 2.

...

ignored.

Value

Returns a filtered data.frame.

See Also

tidy_colo_dtm

Examples

1
2
3
4
5
6
7
dat <- data.frame(
    term_1 = LETTERS[1:10],
    term_2 = LETTERS[10:1],
    stringsAsFactors = FALSE
)

unique_pairs(dat)

textshape documentation built on May 29, 2021, 1:07 a.m.