From 3bed8a868b6bba0083cb981a306c5920e999a296 Mon Sep 17 00:00:00 2001 From: "Guilherme D. Garcia" Date: Tue, 26 Dec 2023 17:57:14 -0500 Subject: [PATCH] updated package with age-related functions --- NAMESPACE | 2 +- R/age_conversion.R | 8 ++++---- README.Rmd | 2 +- man/{months.Rd => monthsAge.Rd} | 10 +++++----- vignettes/Fonology.Rmd | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) rename man/{months.Rd => monthsAge.Rd} (76%) diff --git a/NAMESPACE b/NAMESPACE index 05a994a..3c8002e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,7 +16,7 @@ export(ipa_pt_test) export(ipa_sp_test) export(meanAge) export(meanSonDisp) -export(months) +export(monthsAge) export(nGramTbl) export(plotSon) export(plotVowels) diff --git a/R/age_conversion.R b/R/age_conversion.R index 4f22ed0..62ed935 100644 --- a/R/age_conversion.R +++ b/R/age_conversion.R @@ -6,10 +6,10 @@ #' @return Age in months #' @export #' @examples -#' months("02;06") -#' months("05:03", sep = ":") +#' monthsAge("02;06") +#' monthsAge("05:03", sep = ":") -months = function(age, sep = ";"){ +monthsAge = function(age, sep = ";"){ pattern1 = stringr::str_c("\\d", sep) pattern2 = stringr::str_c(sep, "\\d+") y = stringr::str_extract(age, pattern = pattern1) |> @@ -37,7 +37,7 @@ months = function(age, sep = ";"){ #' meanAge(age = c("05:03", "04:07"), sep = ":") meanAge = function(age, sep = ";"){ - age_in_months = months(age, sep) + age_in_months = monthsAge(age, sep) mean_age = mean(age_in_months, na.rm = TRUE) ye = mean_age %/% 12 diff --git a/README.Rmd b/README.Rmd index acd3f4c..ba620e3 100644 --- a/README.Rmd +++ b/README.Rmd @@ -163,7 +163,7 @@ tibble(word = character(5)) |> ## Extras -Additional functions include `months()` and `meanAge()`, both of which can be used to convert and analyze ages following the format `yy;mm`, commonly used in first language acquisition studies. It's a good idea to check out the index of functions (`?Fonology`) to take a look at the complete list of functions available. +Additional functions include `monthsAge()` and `meanAge()`, both of which can be used to convert and analyze ages following the format `yy;mm`, commonly used in first language acquisition studies. It's a good idea to check out the index of functions (`?Fonology`) to take a look at the complete list of functions available. ## References diff --git a/man/months.Rd b/man/monthsAge.Rd similarity index 76% rename from man/months.Rd rename to man/monthsAge.Rd index 1249070..7678807 100644 --- a/man/months.Rd +++ b/man/monthsAge.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/age_conversion.R -\name{months} -\alias{months} +\name{monthsAge} +\alias{monthsAge} \title{Age conversion} \usage{ -months(age, sep = ";") +monthsAge(age, sep = ";") } \arguments{ \item{age}{Age in yy;mm format} @@ -18,6 +18,6 @@ Age in months Calculates age in months based on yy;mm format, commonly used in language acquisition studies } \examples{ -months("02;06") -months("05:03", sep = ":") +monthsAge("02;06") +monthsAge("05:03", sep = ":") } diff --git a/vignettes/Fonology.Rmd b/vignettes/Fonology.Rmd index d52eb0b..3c382a0 100644 --- a/vignettes/Fonology.Rmd +++ b/vignettes/Fonology.Rmd @@ -150,7 +150,7 @@ tibble(word = wug_pt("LHL", n = 5)) |> ## Extras -Additional functions include `months()` and `meanAge()`, both of which can be used to convert and analyze ages following the format `yy;mm`, commonly used in first language acquisition studies. It's a good idea to check out the index of functions (`?Fonology`) to take a look at the complete list of functions available. +Additional functions include `monthsAge()` and `meanAge()`, both of which can be used to convert and analyze ages following the format `yy;mm`, commonly used in first language acquisition studies. It's a good idea to check out the index of functions (`?Fonology`) to take a look at the complete list of functions available. ## References