longest_substring_vec: Find Longest Common Substring (Vectorised)

Description Usage Arguments Value

View source: R/functions.R

Description

A wrapper that vectorizes function longest_substring, allowing an input vector and either a vector or matrix output.

Usage

1
2
longest_substring_vec(a, b = NULL, default = NA_character_,
  matrix_out = is.null(b), USE.NAMES = matrix_out)

Arguments

a

a character vector

b

a character vector, or NULL (default) indicating taking a as b

default

value to return when no matching substring is found. By default NA_character_

matrix_out

logical. If TRUE, returns a matrix of common substrings. If FALSE, returns a vector of common substrings.

USE.NAMES

logical. If TRUE, displays names in output. If matrix_out = FALSE, names of a will be used.

Value

Depending on matrix_out either a vector or a matrix of longest common substrings. If matrix_out = TRUE, returns a matrix of longest common substring for each of the elements of a and b, with rows and columns corresponding to a and b respectively. If matrix_out = FALSE, returns a vector of common substrings for the corresponding elements in vector a and b.


UMCUneuro/MRI documentation built on May 25, 2019, 1:36 p.m.