Subunit in the curve
Usage
# S3 method for sfc_nxn
[(x, i, j, ..., drop = TRUE)
# S4 method for sfc_nxn
sfc_index(p, index = "")
Arguments
- x
An
sfc_nxn
object.- i, index
A string of digits representing the path on the hierarchy of the curve. The left side corresponds to the top level and the right side corresponds to the bottom level on the curve. For the 2x2 curve, the digits can only be 1-4, and for the Peano and Meander curves, the digites can be 1-9. The hierarchical index should be specified in a format of
i1:i2:i3:...
where:
can be replaced by any non-number character. For 2x2 and 3x3 curves,:
can be omitted and the hierarchical index can be specified asi1i2i3...
. See the Examples section.- j
A value of
TRUE
orFALSE
that controls whether to keep thesfc_nxn
class or degenerate to thesfc_sequence
class.- ...
Ignore.
- drop
A value of
TRUE
orFALSE
that controls whether to keep thesfc_nxn
class or degenerate to thesfc_sequence
class.- p
An
sfc_nxn
object.
Examples
p = sfc_2x2("I", "11111")
p["3:2:1"]
#> A sequence of 16 base patterns.
#> I(270)L(270)L(0)R(90) I(0)R(0)R(270)L(180)
#> L(270)R(0)R(270)I(180) R(180)L(90)L(180)I(270)
# for 2x2 and 3x3 curves, ":" can be omitted
p["321"]
#> A sequence of 16 base patterns.
#> I(270)L(270)L(0)R(90) I(0)R(0)R(270)L(180)
#> L(270)R(0)R(270)I(180) R(180)L(90)L(180)I(270)
p["3:2:1", TRUE] # or p["3:2:1", drop = FALSE]
#> An sfc_2x2 object.
#> Increase mode: 2 x 2
#> Level: 5
#> Expansion rule: 2x2
#> A fragment from the original curve.
#>
#> A sequence of 16 base patterns.
#> I(270)L(270)L(0)R(90) I(0)R(0)R(270)L(180)
#> L(270)R(0)R(270)I(180) R(180)L(90)L(180)I(270)
#>
#> Seed: A sequence of 1 base pattern.
#> I(0)
# only for testing
p = sfc_2x2("I", "11111")
om = par(no.readonly = TRUE)
par(mfrow = c(2, 2))
sfcurve:::test_sfc_index(p, "3")
sfcurve:::test_sfc_index(p, "3:2")
sfcurve:::test_sfc_index(p, "3:2:1")
sfcurve:::test_sfc_index(p, "3:2:1:1")
par(om)
p = sfc_3x3_meander("I", "11111")
om = par(no.readonly = TRUE)
par(mfrow = c(2, 2))
sfcurve:::test_sfc_index(p, "7")
sfcurve:::test_sfc_index(p, "7:5")
sfcurve:::test_sfc_index(p, "7:5:9")
sfcurve:::test_sfc_index(p, "7:5:9:2")
par(om)