Check if all elements of x
are also contained in y
. This is equivalent
to testing whether setdiff(x, y)
is empty.
Value
A logical scalar. Returns TRUE
if x
is a subset of y
, i.e. all
elements of x
are also elements of y
. Returns FALSE
otherwise.
Details
If
x
is empty, the result is alwaysTRUE
(the empty set is a subset of any set).If
y
is empty andx
is not, the result isFALSE
.Duplicates in
x
are ignored; only set membership is tested.NA
values are treated as ordinary elements. In particular,NA
inx
is considered a subset element only ifNA
is also present iny
.