sfc_index: Subunit in the curve

[.sfc_nxnR Documentation

Subunit in the curve

Description

Subunit in the curve

Usage

## S3 method for class 'sfc_nxn'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'sfc_nxn'
sfc_index(p, index = "")

test_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 as i1i2i3.... See the Examples section.

j

A value of TRUE or FALSE that controls whether to keep the sfc_nxn class or degenerate to the sfc_sequence class.

...

Ignore.

drop

A value of TRUE or FALSE that controls whether to keep the sfc_nxn class or degenerate to the sfc_sequence class.

p

An sfc_nxn object.

Details

sfc_index() only works on square curves (i.e. a curve with a single base letter as seed.)

test_sfc_index() is a helper function for demonstrating sfc_index().

Value

sfc_index() returns an integer vector.

Examples

p = sfc_2x2("I", "11111")
p["3:2:1"]
# for 2x2 and 3x3 curves, ":" can be omitted
p["321"]
p["3:2:1", TRUE] # or p["3:2:1", drop = FALSE]
# only for testing
p = sfc_2x2("I", "11111")
om = par(no.readonly = TRUE)
par(mfrow = c(2, 2))
test_sfc_index(p, "3")
test_sfc_index(p, "3:2")
test_sfc_index(p, "3:2:1")
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))
test_sfc_index(p, "7")
test_sfc_index(p, "7:5")
test_sfc_index(p, "7:5:9")
test_sfc_index(p, "7:5:9:2")
par(om)

sfcurve documentation built on Sept. 14, 2024, 1:07 a.m.