elementprop: Proportion of elements in a sequence

View source: R/elementprop.R

elementpropR Documentation

Proportion of elements in a sequence

Description

Proportion of elements in a sequence

Usage

elementprop(S, target)

Arguments

S

character of length 1 or longer, contains the sequence

target

character of length 1: occurence of which element to model

Details

sequences cannot contain NAs at this point.

Value

the porportion of target elements in S

Examples

elementprop("AAABBB", "B") #should be 0.5
elementprop("AAAB", "A") # should be 0.75
elementprop("AB", "A") # should be 0.5

S <- c("A", "A", "A", "B", "B", "B")
elementprop(S, target="A")
elementprop(S, target="X")

gobbios/cfp documentation built on April 11, 2022, 2:22 a.m.