strcomp: Compare the contents of two vectors of character strings.

Description Usage Arguments Value Author(s) Examples

View source: R/text-functions.R

Description

This function compares the contents of two vectors of character strings: how many elements are present in both vectors, how many are only present in each one, etc., and lists the elements that are only present in one of the vectors.

Usage

1
strcomp(text1, text2)

Arguments

text1, text2

two character vectors to be compared

Value

A list containing the following elements:

matchTable: a cross table of all the unique elements of the concatenation of text1 and text2, indicating whether they belong to text1 and/or to text2.

matchOneInTwo: a table of the elements of text1 according to how many times they are present in text2.

matchTwoInOne: a table of the elements of text2 according to how many times they are present in text1.

tabOneInTwo: a table of the elements of text1 according to whether they are present in text2.

tabTwoInOne: a table of the elements of text2 according to whether they are present in text1.

oneNotInTwo: a vector containing the elements of text1 not present in text2.

twoNotInOne: a vector containing the elements of text2 not present in text1.

Author(s)

Julien Boelaert jubo.stats@gmail.com

Examples

1
2
3
str1 <- c("Alice", "Alice", "Bob", "Carol")
str2 <- c("Bob", "Denise", "Emerson", "Foteini")
strcomp(str1, str2)

scraEP documentation built on June 23, 2021, 9:06 a.m.