Learn R Programming

AnimalSequences (version 0.2.0)

average_seq_length: Calculate the Average Length of Sequences

Description

This function calculates the average length of a sequence of elements, where each sequence is split by spaces.

Usage

average_seq_length(sequences)

Value

A numeric value representing the average length of the sequences.

Arguments

sequences

A character vector where each element is a sequence of elements separated by spaces.

Examples

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

Run the code above in your browser using DataLab