Learn R Programming

AnimalSequences (version 0.2.0)

compare_distinct_elements_per_list_item: Compare True and Shuffled Distinct Elements per List Item

Description

This function compares the true number of distinct elements per list item in a list of sequences to the number of distinct elements per list item in shuffled sequences. The comparison is done by calculating p-values from shuffled sequences.

Usage

compare_distinct_elements_per_list_item(sequences, iterations = 100)

Value

A data frame with columns:

true_distinct_elements

The number of distinct elements per list item in the original sequences.

shuffled_distinct_elements

The average number of distinct elements per list item in shuffled sequences.

p_value

The p-value representing the proportion of shuffled sequences where the number of distinct elements is less than or equal to the true number.

Arguments

sequences

A list of character vectors, where each vector contains sequences of elements separated by spaces.

iterations

An integer specifying the number of shuffling iterations.

Examples

Run this code
sequences <- c('hello world', 'hello world hello', 'hello world hello world', 'hello world')
compare_distinct_elements_per_list_item(sequences, iterations = 100)

Run the code above in your browser using DataLab