Extract.multipol | R Documentation |
Extract or replace subsets of multipols
## S3 method for class 'multipol'
x[...]
## S3 replacement method for class 'multipol'
x[...] <- value
x |
A multipol |
... |
Indices to replace. Offset zero! See details section |
value |
replacement value |
Extraction and replacement operate with offset zero (using functions
taken from the Oarray package); see the examples section. This
is so that the index matches the power required (there is an
off-by-one issue. The first element corresponds to the
zeroth power. One wants index i
to extract/replace the
i
-th power and in particular one wants index 0
to
extract/replace the zeroth power).
Replacement operators return a multipol. Extraction returns an array. This is because it is often not clear exactly what multipol is desired from an extraction operation (it is also consistent with Oarray's behaviour).
Original code taken from the Oarray package by Jonty Rougier
Jonathan Rougier (2007). Oarray: Arrays with arbitrary offsets. R package version 1.4-2.
a <- as.multipol(matrix(1,4,6))
a[2,2] <- 100
a # coefficient of x1^2.x2^2 is 100
a[1:2,1:2] # a matrix. Note this corresponds to first and second powers
# not zeroth and first (what multipol would you want here?)
a[2,2] # 100 to match the "a[2,2] <- 100" assignment above
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.