Learn R Programming

calACS (version 2.2.2)

lenLCSStrict: Calculate the length of the longest common subsequence (KCS) between a string and a vector/list of strings. Subsequences cannot be interrupted by any item, i.e. q-w is not considered a subsequence of q-e-w-r due to the interrupting 'e'

Description

Calculate the length of the longest common subsequence (KCS) between a string and a vector/list of strings. Subsequences cannot be interrupted by any item, i.e. q-w is not considered a subsequence of q-e-w-r due to the interrupting 'e'

Usage

lenLCSStrict(vecA, listB, sep = "-", dropFirstItem = FALSE)

Arguments

vecA
The single string
listB
The vector/list of 1 or more strings
sep
Delimiter separating each items in a sequence
dropFirstItem
Boolean. If true, the first item in each sequence is excluded from counting all subsequences

Value

A list of vectors of the length of each common subsequence

Examples

Run this code
lenACSStrict("q-w-e-r", c("q-e-w-r","q-r-e-w","q-w-r-e"), "-")
lenACSStrict("itemToBeDropped-q-w-e-r", "itemToBeDroped-q-e-w-r", "-", dropFirstItem=TRUE)

Run the code above in your browser using DataLab