Learn R Programming

wordgraph (version 0.1.0)

freq.of.all.combinations.df: Count all combinations between the values of column1 and column2.

Description

Count all combinations between the values of column1 and column2 and return a data frame with the combination of the items and the respecting frequencies.

Usage

freq.of.all.combinations.df(column1, column2, data.df, order = 0, removeNA = TRUE)

Arguments

column1

The name of the first column

column2

The name of the second column

data.df

The data frame containing the columns column1, column2

order

0 (default): no order, 1: descenting frequancy order, 2: ascenting wordcode order, 3: ascenting word order.

removeNA

Should remove any NA values or count them in their combination? Default is TRUE (remove NA).

Value

A data frame containing the frequencies of all pairs of values between column1 and column2. It counts all pair occurences independent of position, thus the pairs of (column1, column2): (a, b), (a, b), (b, a) will result to the entry in freq.of.all.combinations.df of (word1 = a, word2 = b, freq = 3).

Examples

Run this code
# NOT RUN {
# It is a time consuming function...
# Thus, for illustrative purposes, an example is provided in a small
# random subset of the original data...

freeassociationdata_part = dplyr::sample_n(freeassociationdata, 10)


df.with.frequencies = freq.of.all.combinations.df("diet1stword", "diet2ndword",
freeassociationdata_part)

head(df.with.frequencies)
# }

Run the code above in your browser using DataLab