Learn R Programming

AnimalSequences (version 0.2.0)

count_distinct_elements_per_list_item: Count Distinct Elements per List Item

Description

This function calculates the average number of distinct elements per item in a list of sequences, where each sequence is split by spaces.

Usage

count_distinct_elements_per_list_item(sequences)

Value

A numeric value representing the average number of distinct elements per list item.

Arguments

sequences

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

Examples

Run this code
sequences <- c('hello world', 'hello world hello', 'hello world hello world')
count_distinct_elements_per_list_item(sequences)

Run the code above in your browser using DataLab