Skip to contents

Get a ggplot2 xlim object based on duration data

Usage

xlim_duration(object, expr = .data$Tier == "Form")

Arguments

object

Duration object.

expr

R expression to subset rows.

Value

a 'Duration' object.

Examples

# \donttest{
r<-get_recording("NIR_ABh_Puriya", fps=25)
m <- get_metre_data(r)
d <- get_duration_annotation_data(r)
autoplot(m)
#> Warning: Removed 1 row containing missing values (`geom_line()`).

autoplot(m) + autolayer(d)
#> Warning: Removed 1 row containing missing values (`geom_line()`).

v <- get_raw_view(r, "Central", "", "Sitar")
autoplot(v, columns = c("LEar_x", "LEar_y")) + autolayer(d)
#> Warning: Sampling rows for plotting
#> Warning: Removed 11 rows containing missing values (`geom_line()`).

autoplot(v, columns = c("LEar_x", "LEar_y")) +
xlim_duration(d, expr = Tier == "FORM" & substr(Comments, 1, 1) == "J") +
autolayer(d, expr = Tier == "FORM" & substr(Comments, 1, 1) == "J")
#> Warning: Sampling rows for plotting
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
#> Warning: Removed 2000 rows containing missing values (`geom_line()`).

# }