[,Diff,numeric,missing,missing-method {diffobj} | R Documentation |
Subsetting Methods for Diff Objects
Description
Methods to subset the character representation of the diff output. The subsetting bears no link to the line numbers in the diffs, only to the actual displayed diff.
Usage
## S4 method for signature 'Diff,numeric,missing,missing'
x[i]
## S4 method for signature 'Diff'
head(x, n, ...)
## S4 method for signature 'Diff'
tail(x, n, ...)
Arguments
x |
|
i |
subsetting index, must be numeric |
n |
integer(1L), the size for the resulting object |
... |
unused, for compatibility with generics |
Details
[
only supports numeric indices, and returns without error if you
specify out of bound indices. If you apply multiple subsetting methods they
will be applied in the following order irrespective of what order you
actually specify them in: [
, then head
, then tail
.
If you use the same subsetting method multiple times on the same object,
the last call will define the outcome.
These methods are implemented by storing the chosen indices in the
Diff
object and using them to subset the as.character
output.
This mechanism explains the seemingly odd behavior documented above.
Value
Diff
object with subsetting indices recorded for use by
show
## 'pager="off"' for CRAN compliance; you may omit in normal use
diff <- diffChr(letters, LETTERS, format="raw", pager="off")
diff[5:15]
head(diff, 5)
tail(diff, 5)
head(head(diff, 5), 8) ## note not 'typical' behavior