Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

longestConsecutive

Obtain the length of the longest substring containing only 'letter'


Description

This function accepts a character vector and computes the length of the longest substring containing only letter for each element of x.

Usage

longestConsecutive(seq, letter)

Arguments

seq

Character vector.

letter

Character vector of length 1, containing one single character.

Details

The elements of x can be in upper case, lower case or mixed. NAs are handled.

Value

An integer vector of the same length as x.

Author(s)

W. Huber

Examples

v = c("AAACTGTGFG", "GGGAATT", "CCAAAAAAAAAATT")
 longestConsecutive(v, "A")

Biostrings

Efficient manipulation of biological strings

v2.58.0
Artistic-2.0
Authors
H. Pagès, P. Aboyoun, R. Gentleman, and S. DebRoy
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.