Creation and manipulation of span objects.
Span(start, end)
as.Span(x)
is.Span(x)
For Span()
and as.Span()
, a span object (of class
"Span"
).
For is.Span()
, a logical.
integer vectors giving the start and end positions of the spans.
an R object.
A single span is a pair with “slots” ‘start’ and ‘end’, giving the start and end positions of the span.
Span objects provide sequences (allowing positional access) of single
spans. They have class "Span"
. Span objects can be coerced to
annotation objects via as.Annotation()
(which of course is
only appropriate provided that the spans are character spans of the
natural language text being annotated), and annotation objects can be
coerced to span objects via as.Span()
(giving the character spans
of the annotations).
Subscripting span objects via [
extracts subsets of spans;
subscripting via $
extracts integer vectors with the sequence
of values of the named slot.
There are several additional methods for class "Span"
:
print()
and format()
;
c()
combines spans (or objects coercible to these using
as.Span()
), and
as.list()
and as.data.frame()
coerce, respectively, to
lists (of single span objects) and data frames (with spans and slots
corresponding to rows and columns). Finally, one can add a scalar and
a span object (resulting in shifting the start and end positions by
the scalar).
Span()
creates span objects from the given sequences of start
and end positions, which must have the same length.
as.Span()
coerces to span objects, with a method for annotation
objects.
is.Span()
tests whether an object inherits from class
"Span"
(and hence returns TRUE
for both span and
annotation objects).