sonfacet {playitbyr} | R Documentation |
Allows creation of ‘facets’ for a sonification,
i.e. to separately sonify different groups of a dataset,
one after another. Analogous to ggplot2's
facet_wrap
.
sonfacet(facet = NULL, scales = "fixed", pause = 0.5)
facet |
Variable to split by |
scales |
Should scales be fixed ( |
pause |
Length of pause, in seconds, between each facet |
When added onto a sonify
object, this function
splits the data by the variable given in facets
and creates separate sonifications for each subset of the
data. All factor levels not used in the data will
automatically be dropped.
Unlike facet_wrap
, this function does not take a
formula–instead it only takes the name of the data
variable to split by.
df <- data.frame(pits = c(0, 1, 1, 2, 2, 3), tims = c(0, 1, 0, 1, 0, 1), facs = c(0, 0, 1, 1, 2, 2)) x <- sonify(df, sonaes(time = tims, pitch = pits)) + shape_scatter(dur = 1) + scale_time_continuous(c(0, 1)) + scale_pitch_continuous(c(8, 8.25)) + sonfacet(facs, pause = 1) ## Not run: x