Type: | Package |
Title: | Set Operation |
Version: | 1.2 |
Author: | Zhi Jin, Jing Zhang |
Maintainer: | Zhi Jin <nalanchongxuan@163.com> |
Description: | More easy to get intersection, union or complementary set and combinations. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Imports: | do |
URL: | https://github.com/yikeshu0611/set |
BugReports: | https://github.com/yikeshu0611/set/issues |
NeedsCompilation: | no |
Packaged: | 2021-02-21 15:02:44 UTC; asus |
Repository: | CRAN |
Date/Publication: | 2021-02-26 15:10:02 UTC |
Get Intersection Set for Sets
Description
Get intersection set for sets.
Usage
and(...)
a %and% b
Arguments
... |
one or more objects |
a |
one object |
b |
the other object |
Value
intersection elements
Examples
A <- c("a","b","c")
B <- c("a","b","c","d")
C <- c("a","e","h")
and(A, B)
and(A, B, C)
A <- c("a","b","c")
B <- c("a","b","c","d")
C <- c("a","e","h")
A %and% B
A %and% B %and% C
Combination of Characters or Vectors
Description
Combination of characters or vectors.
Usage
combination(...)
Arguments
... |
one or more vectors |
Value
binary combination
Examples
A <- c("a","b","c")
combination(A)
B <- c("a","b","c","d")
C <- c("a","e","h")
D <- c("a","b","e")
E <- c("a","c")
combination(A,B)
combination(A,B,C)
combination(A,B,C,D)
combination(A,B,C,D,E)
Grep for vectors
Description
Grep for vectors
Usage
grep_or(x, patterns)
grep_and(x, patterns)
grep_not_and(x, patterns)
grep_not_or(x, patterns)
Arguments
x |
vectors with one or more characters |
patterns |
vectors with one or more characters |
Value
vectors
Examples
x=c('a12','a','b')
patterns=c('b','1')
grep_or(x,patterns)
x=c('a12','a1','b')
patterns=c('a','1')
grep_and(x,patterns)
x=c('a12','a','b')
patterns=c('a','1')
grep_not_and(x,patterns)
x=c('a12','a','b')
patterns=c('a','1')
grep_not_or(x,patterns)
Grepl for vectors
Description
Grepl for vectors
Usage
grepl_or(x, patterns)
grepl_and(x, patterns)
grepl_not_and(x, patterns)
grepl_not_or(x, patterns)
Arguments
x |
vectors with one or more characters |
patterns |
vectors with one or more characters |
Value
vectors
Examples
x=c('a12','a','b')
patterns=c('b','1')
grepl_or(x,patterns)
x=c('a12','a1','b')
patterns=c('a','1')
grepl_and(x,patterns)
x=c('a12','a','b')
patterns=c('a','1')
grepl_not_and(x,patterns)
x=c('a12','a','b')
patterns=c('a','1')
grepl_not_or(x,patterns)
Get Elements only Existed in Dataset a
Description
Get elements only existed in dataset a.
Usage
not(...)
a %not% b
Arguments
... |
one or more objects |
a |
one object |
b |
the other object |
Value
elements only existed in dataset a
Examples
A <- c("a","b")
B <- c("a","b","c","d")
not(B, A)
E <- c('d')
not(B, A, E)
A <- c("a","b","c")
B <- c("a","b","c","d")
B %not% A
Get Union Set for Sets
Description
Get union set for sets.
Usage
or(...)
a %or% b
Arguments
... |
one or more objects |
a |
one object |
b |
the other object |
Value
union elements
Examples
A <- c("a","b","c")
B <- c("a","b","c","d")
C <- c("a","e","h")
or(A, B)
or(A, B, C)
A <- c("a","b","c")
B <- c("a","b","c","d")
C <- c("a","e","h")
A %or% B
A %and% B %or% C