From 98b30bd36189b39cc60cc4c5a64911b4bf378ca0 Mon Sep 17 00:00:00 2001 From: howardbaek Date: Mon, 10 Jul 2023 14:26:17 -0700 Subject: [PATCH] `pad_wav()` Documentation --- R/pad_wav.R | 17 +++++++++-------- man/pad_wav.Rd | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/R/pad_wav.R b/R/pad_wav.R index 475c8f7..32ab549 100644 --- a/R/pad_wav.R +++ b/R/pad_wav.R @@ -1,10 +1,10 @@ #' Pad Wave Objects #' -#' @param wav list of Wave objects +#' @param wav List of Wave objects #' @param duration If \code{NULL}, the duration will simply round -#' the Wave up to the next whole integer. If not, these are the -#' duration to pad the Wave *to*. For example 12 means the output -#' Wave will have a length of 12 seconds. Pass \code{NA} to those +#' the Wave up to the next whole integer. If not, these are the +#' duration to pad the Wave *to*. For example, 12 means the output +#' Wave will have a length of 12 seconds. Pass \code{NA} to those #' Waves that you want simple rounding. #' #' @return A list of Wave objects, same length as input \code{wav} @@ -12,11 +12,12 @@ #' #' @importFrom purrr map2 map2_int #' @examples -#' wav_list <- list( -#' tuneR::noise(duration = 2000), -#' tuneR::noise(duration = 1000) +#' library(tuneR) +#' x <- list( +#' noise(duration = 2000), +#' noise(duration = 1000) #' ) -#' out <- pad_wav(wav_list) +#' out <- pad_wav(x) pad_wav <- function(wav, duration = NULL) { # See if wav inherits from "Wave" class is_Wave <- inherits(wav, "Wave") diff --git a/man/pad_wav.Rd b/man/pad_wav.Rd index f073156..d00d5dc 100644 --- a/man/pad_wav.Rd +++ b/man/pad_wav.Rd @@ -7,12 +7,12 @@ pad_wav(wav, duration = NULL) } \arguments{ -\item{wav}{list of Wave objects} +\item{wav}{List of Wave objects} \item{duration}{If \code{NULL}, the duration will simply round -the Wave up to the next whole integer. If not, these are the -duration to pad the Wave *to*. For example 12 means the output -Wave will have a length of 12 seconds. Pass \code{NA} to those +the Wave up to the next whole integer. If not, these are the +duration to pad the Wave *to*. For example, 12 means the output +Wave will have a length of 12 seconds. Pass \code{NA} to those Waves that you want simple rounding.} } \value{ @@ -22,9 +22,10 @@ A list of Wave objects, same length as input \code{wav} Pad Wave Objects } \examples{ -wav_list <- list( - tuneR::noise(duration = 2000), - tuneR::noise(duration = 1000) +library(tuneR) +x <- list( + noise(duration = 2000), + noise(duration = 1000) ) -out <- pad_wav(wav_list) +out <- pad_wav(x) }