diff --git a/DESCRIPTION b/DESCRIPTION index 5e13083c28..825a767fd8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -72,4 +72,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/NAMESPACE b/NAMESPACE index 8e9b124535..aaf646d9d4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -138,6 +138,7 @@ export(get_not_mapped) export(get_one_to_many_dataset) export(get_summary_records) export(get_vars_query) +export(hello_admiral) export(impute_dtc_dt) export(impute_dtc_dtm) export(lastalive_censor) diff --git a/NEWS.md b/NEWS.md index f204cac8e7..7d8321fca3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,8 +2,7 @@ ## New Features -- New function `derive_vars_crit_flag()` for deriving criterion flag variables -(`CRITy`, `CRITyFL`, `CRITyFLN`). (#2468) +- New function 'my_first_fcn()' as dummy practice (#1839) ## Updates of Existing Functions diff --git a/R/my_first_fcn.R b/R/my_first_fcn.R new file mode 100644 index 0000000000..83088289c2 --- /dev/null +++ b/R/my_first_fcn.R @@ -0,0 +1,25 @@ +#' @name my_first_fcn.R +#' +#' @title Hello Admiral Function +#' +#' @param hw TRUE or FALSE +#' +#' @details First function to generate welcome message +#' +#' @return Happy Message +#' +#' @family der_adxx +#' +#' @keywords der_adxx +#' +#' @export +#' +#' @examples +#' hello_admiral(hw = FALSE) +hello_admiral <- function(hw = TRUE) { + if (hw) { + message("Welcome to the admiral family!") + } else { + message("Welcome to the admiral family!") + } +} diff --git a/inst/WORDLIST b/inst/WORDLIST index ad1b8d709e..16fefe5761 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -14,6 +14,7 @@ ADVS ADaM ADaMIG ADaMs +adxx AE AEDECOD AELLTCD @@ -89,6 +90,7 @@ EPI Ehmann FACM FCVD +fcn Fibrinogen Findability Framingham diff --git a/man/my_first_fcn.R.Rd b/man/my_first_fcn.R.Rd new file mode 100644 index 0000000000..cc71e399e2 --- /dev/null +++ b/man/my_first_fcn.R.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/my_first_fcn.R +\name{my_first_fcn.R} +\alias{my_first_fcn.R} +\alias{hello_admiral} +\title{Hello Admiral Function} +\usage{ +hello_admiral(hw = TRUE) +} +\arguments{ +\item{hw}{TRUE or FALSE} +} +\value{ +Happy Message +} +\description{ +Hello Admiral Function +} +\details{ +First function to generate welcome message +} +\examples{ +hello_admiral(hw = FALSE) +} +\concept{der_adxx} +\keyword{der_adxx} diff --git a/tests/testthat/test-my_first_fcn.R b/tests/testthat/test-my_first_fcn.R new file mode 100644 index 0000000000..72e4aac15a --- /dev/null +++ b/tests/testthat/test-my_first_fcn.R @@ -0,0 +1,20 @@ +test_that("hello admiral greets without hw", { + expect_message( + hello_admiral(), + "^Welcome to the admiral family!\\n" + ) +}) + +test_that("hello admiral greets with hw", { + expect_message( + hello_admiral(hw = TRUE), + "^Welcome to the admiral family!\\n" + ) +}) + +test_that("hello admiral greets with hw", { + expect_message( + hello_admiral(hw = FALSE), + "^Welcome to the admiral family!\\n" + ) +})