Extract or replace parts of a hyper2 object
1 2 3 4
An object of class
Further arguments, currently ignored
A list with integer vector elements corresponding to the brackets whose power is to be replaced
Numeric vector of powers
These methods should work as expected, although the off-by-one issue might be a gotcha.
For the extract method, a numeric vector is returned but the elements may be in any order (the brackets and indeed the powers are not stored in any particular order).
The replace method,
H[L] <- value, the index
L is a list
specifying the brackets to be overwritten; argument
value is not
recycled unless it is of length 1.
If the index argument is missing, viz
H1 <- H2, this is a
special case. Argument
H1 must be a
hyper2 object, and
the idiom effectively executes
H1[brackets(H2)] <- powers(H2),
but more efficiently (note that this operation is well-defined even
though the order of the brackets is arbitrary). This special case is
included in the package because it has a very natural
overwrite() in the
that was too neat to omit.
Altering (incrementing or decrementing) the power of a single bracket
is possible using idiom like
H[x] <- H[x] + 1; this is
The extractor method returns a
hyper2 object, restricted to the
brackets() to extract a numeric vector of
powers or a list of integer vectors respectively.
H[x] <- val cannot use non-trivial recycling.
This is because the elements of
H are stored in an arbitrary
order, but the elements of
val are stored in a particular order.
Also see function
Robin K. S. Hankin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.