Skip to content

Commit

Permalink
updated package with age-related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermegarcia committed Dec 26, 2023
1 parent de4f154 commit 3bed8a8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions R/age_conversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) |>
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions man/months.Rd → man/monthsAge.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/Fonology.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3bed8a8

Please sign in to comment.