plot_percentage_v: Plot Percentage V

View source: R/plot_percentage_v.R

plot_percentage_vR Documentation

Plot Percentage V

Description

This function loads a dataframe as input and returns a box plot for %V values.

Usage

plot_percentage_v(
  df,
  v_label,
  utterance_id,
  cv_duration,
  save_fig = FALSE,
  fig_path = NULL
)

Arguments

df:

a data frame containing cv_labels, utterance_id, and cv_duration values.

v_label:

a string to filter the vowels, e.g. v_label = 'V' or v_label = 'vowel'

utterance_id:

each unique utterance should have a unique id

cv_duration:

the duration of C or V

save_fig:

the default value is set to FALSE. Change to TRUE to save the plot.

fig_path:

the default value is set to NULL. If save_fig is set to TRUE, the path to save the figure is needed.

Value

A boxplot for %V values.

Author(s)

Cong Zhang, cong.zhang@ru.nl

Examples

df <- data.frame (cv_label  = c("consonant", "vowel", "consonant", "vowel",
                                "consonant", "vowel", "consonant", "vowel"),
                  utterance_id = c("utt_1", "utt_1", "utt_2", "utt_2",
                                   "utt_1", "utt_1", "utt_2", "utt_2"),
                  cv_duration = c(0.1, 0.8, 0.2, 0.5, 0.3, 0.3, 0.4, 0.7),
                  utterance_duration = c(2.4, 2.4, 2.7, 2.7, 2.4, 2.4, 2.7, 2.7))

# Saving the plot
plot_percentage_v(df, v_label="vowel", utterance_id, cv_duration, save_fig=T, fig_path='C:/Users/congzhang/Desktop/')

# Not saving the plot
plot_percentage_v(df, v_label="vowel", utterance_id, cv_duration, save_fig=FALSE)


congzhang365/rhythm.metrics documentation built on March 31, 2024, 5:57 p.m.