Single bracket indexing and assignment. See tabr-methods() for more details on methods for tabr classes.

# S3 method for noteworthy
[(x, i)

# S3 method for noteinfo
[(x, i)

# S3 method for music
[(x, i)

# S3 method for lyrics
[(x, i)

# S3 method for noteworthy
[(x, i) <- value

# S3 method for noteinfo
[(x, i) <- value

# S3 method for music
[(x, i) <- value

# S3 method for lyrics
[(x, i) <- value

Arguments

x

object.

i

index.

value

values to assign at index.

Examples

# noteworthy class examples
x <- as_noteworthy("a, b, c ce_g d4f#4a4")
x[3:4]
#> <Noteworthy string>
#>   Format: space-delimited time
#>   Values: c <ce_g>
x[-2]
#> <Noteworthy string>
#>   Format: space-delimited time
#>   Values: a, c <ce_g> <d'g_'a'>
x[2] <- paste0(transpose(x[2], 1), "~")
x
#> <Noteworthy string>
#>   Format: space-delimited time
#>   Values: a, c~ c <ce_g> <d'g_'a'>

# noteinfo class examples
x <- as_noteinfo(c("4-", "t8(", "t8)", "t8x", "8^", "16"))
x[2:4]
#> <Note info string>
#>   Format: vectorized time
#>   Values: t8( t8) t8x
x[-1]
#> <Note info string>
#>   Format: vectorized time
#>   Values: t8( t8) t8x 8^ 16
x[5:6] <- c("16^", "8")
x
#> <Note info string>
#>   Format: vectorized time
#>   Values: 4- t8( t8) t8x 16^ 8
x[x == "4-"]
#> <Note info string>
#>   Format: vectorized time
#>   Values: 4-

# music class examples
x <- as_music("c,~4 c,1 c'e_'g'4-.*4")
x[1:3]
#> <Music string>
#>   Format: space-delimited time
#>   Values: c,~4 c,1 <c'e_'g'>4-.
x[-c(1:2)]
#> <Music string>
#>   Format: space-delimited time
#>   Values: <c'e_'g'>4-. <c'e_'g'>4-. <c'e_'g'>4-. <c'e_'g'>4-.
x[3:6] <- "c'e'g'8"
x
#> <Music string>
#>   Format: space-delimited time
#>   Values: c,~4 c,1 <c'e'g'>8 <c'e'g'>8 <c'e'g'>8 <c'e'g'>8