lyrics | R Documentation |
Functions for creating and checking lyrics objects.
lyrical(x)
as_lyrics(x, format = NULL)
is_lyrics(x)
lyrics_template(x, format = NULL)
x |
character or lyrics object. For |
format |
|
The lyrics
class is a simple class for arranging lyrics text by timestep.
Its structure and behavior aligns with that of the classes noteworthy
,
noteinfo
and music
.
lyrical()
is a trivial function that returns a scalar logical result
essentially for any object that inherits from character, though this check
may become more specific in the future.
as_lyrics()
can be used to coerce to the lyrics
class. Coercion will fail
if the string is not lyrical. The lyrics
class has its own print()
and
summary()
methods.
When format = NULL
, the timestep delimiter format is inferred from the
lyrical string input.
depends on the function
# space-delimited lyrics; use periods for timesteps with no lyric
x <- "These are the ly- rics . . . to this song"
is_lyrics(x)
lyrical(x)
as_lyrics(x)
# character vector; empty, period or NA for no lyric
x <- c("These", "are", "the", "ly-", "rics",
"", ".", NA, "to", "this", "song") #
as_lyrics(x)
# generate empty lyrics object from noteworthy, noteinfo or music object
notes <- as_noteworthy("c d e d c r*3 e g c'")
x <- lyrics_template(notes)
x
x[1:5] <- strsplit("These are the ly- rics", " ")[[1]]
x[9:11] <- c("to", "this", "song")
x
summary(x)
attributes(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.