elementprop: Proportion of elements in a sequence

Description Usage Arguments Details Value Examples

View source: R/elementprop.R

Description

Proportion of elements in a sequence

Usage

1
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

1
2
3
4
5
6
7
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 Sept. 25, 2018, 7:47 p.m.