vintersect: Identify intersection between multiple vectors

Description Usage Arguments Details Author(s) Examples

View source: R/vinteresct.R

Description

Similar to intersect, 'vintersect' identifies values that occure in each vector. The similar code would be to identify intersecting values between two vectors and then look for the intersect with a third vector and so on. Rather, all vectors are input at the same time and intersecting values are returned. The 'limit' parameter can define the minimum number of observations of a value before it is returned. An example would be if you wanted all values that occur in 2 out of 3 vectors (as in the example presented below), for this the 'limit' would be set to 2 and you would supply all three vectors. The returned values will be all values present in at least 2 of the vectors. By default, the limit is set to the number of input vectors to return only values intersecting in all vectors.

Usage

1
vintersect(..., limit = NULL)

Arguments

...

a series of vectors to compare against eachother, either independently input or in a list.

limit

integer The number of minimum observations of a single value before it is included in the output. Defaults to the number of input vectors, but can be reduce to increase the number of returned values.

Details

vintersect returns a single vector from input vectors containing intersecting values from the input vectors. 'limit' can be used to specify an observational limit to include values in the output.

Author(s)

Christopher Nobles, Ph.D.

Examples

1
2
3
4
5
A <- c(1,2,3)
B <- c(2,3,4)
C <- c(3,4,5)
vintersect(A, B, C)
vintersect(A, B, C, limit = 2)

cnobles/gintools documentation built on Aug. 22, 2019, 10:36 a.m.