Description Usage Arguments Details Value See Also
Similar to base R set functions, but for objects of class
Schema
. Functions sintersect()
, sdiff()
and sequal()
compare any R object that has a defined as_schema()
method to an object
of class Schema
.
1 2 3 4 5 |
x |
an object of class |
y |
an object of class |
what |
a character equal to:
Argument |
These functions compare the structure of x
to what y
dictates. Comparisons
are always done with respect to y
:
sintersect()
returns the common inputs or prototypes between y
and x
.
sdiff()
returns the differences between inputs or prototypes of y
and
x
. If the underlying schema of x
is a superset of y
, then only the
intersection of y
and x
is looked at. The rest is ignored.
Function sequal()
is a wrapper to sdiff()
. A "strict"
comparison
checks both inputs and prototypes. If the intersection of y
and x
is y
,
then x
and y
are considered to be equal schemas.
If x
is not an object of class Schema
, it it coerced to
such an object by using the appropriate as_schema()
method. This is why
set functions are not generic functions, method dispath is implicitely done
by as_schema()
.
Comparing prototypes makes sense only for common inputs to y
and x
.
Consequently, comparing prototypes triggers a comparison between inputs
first.
Functions sintersect()
and sdiff()
return a named character, possibly
empty. The output of sintersect()
is the set of common inputs (in the sense
given by what
) to y
and x
, while the output of sdiff()
is the set of
inputs that are in y
but not in x
.
Function sequal()
returns a logical. A TRUE
implies equality in the sense
given by what
.
Other Schema:
Schema-accessors
,
Schema-class
,
Schema-coercions
,
Schema-extractors
,
Schema-methods
,
Schema-validators
,
is_schema()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.