From 7c2ddc80cd18ede9566c554da3b841ce65638c6f Mon Sep 17 00:00:00 2001 From: Lun-Hsien Chang Date: Wed, 4 Dec 2024 17:40:56 +1000 Subject: [PATCH 1/5] feat: Add my_first_fcn to welcome new users - Create new function my_first_fcn() - Add corresponding test - Resolves #1839 --- R/my_first_fcn.R | 11 +++++++++++ tests/testthat/test-my_first_fcn.R | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 R/my_first_fcn.R create mode 100644 tests/testthat/test-my_first_fcn.R diff --git a/R/my_first_fcn.R b/R/my_first_fcn.R new file mode 100644 index 0000000000..a6a38779a2 --- /dev/null +++ b/R/my_first_fcn.R @@ -0,0 +1,11 @@ +#' My First Function +#' +#' This function outputs a welcome message for onboarding purposes. +#' +#' @return A string with a welcome message. +#' @export +#' +my_first_fcn <- function() { + "Welcome to the admiral family!" +} + diff --git a/tests/testthat/test-my_first_fcn.R b/tests/testthat/test-my_first_fcn.R new file mode 100644 index 0000000000..bef4ba70d9 --- /dev/null +++ b/tests/testthat/test-my_first_fcn.R @@ -0,0 +1,5 @@ +test_that("my_first_fcn works correctly", { + result <- my_first_fcn() + expect_type(result, "character") # Test that the output is a string + expect_equal(result, "Welcome to the admiral family!") # Test the exact content +}) From 1171f22c0b71d38c9dc5df42c08757fe1652f92a Mon Sep 17 00:00:00 2001 From: Lun-Hsien Chang Date: Thu, 5 Dec 2024 13:30:33 +1000 Subject: [PATCH 2/5] style: Apply tidyverse style to my_first_fcn.R and its test file --- R/my_first_fcn.R | 1 - tests/testthat/test-my_first_fcn.R | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/R/my_first_fcn.R b/R/my_first_fcn.R index a6a38779a2..1002b1a50c 100644 --- a/R/my_first_fcn.R +++ b/R/my_first_fcn.R @@ -8,4 +8,3 @@ my_first_fcn <- function() { "Welcome to the admiral family!" } - diff --git a/tests/testthat/test-my_first_fcn.R b/tests/testthat/test-my_first_fcn.R index bef4ba70d9..b1ef32a788 100644 --- a/tests/testthat/test-my_first_fcn.R +++ b/tests/testthat/test-my_first_fcn.R @@ -1,5 +1,5 @@ test_that("my_first_fcn works correctly", { result <- my_first_fcn() - expect_type(result, "character") # Test that the output is a string - expect_equal(result, "Welcome to the admiral family!") # Test the exact content + expect_type(result, "character") # Test that the output is a string + expect_equal(result, "Welcome to the admiral family!") # Test the exact content }) From 9f3ca92a7afa6064804590fee779398ad862d839 Mon Sep 17 00:00:00 2001 From: Lun-Hsien Chang Date: Wed, 11 Dec 2024 16:00:38 +1000 Subject: [PATCH 3/5] Add my_first_fcn implementation and update documentation, NAMESPACE, and NEWS.md --- NAMESPACE | 1 + NEWS.md | 2 ++ R/my_first_fcn.R | 4 ++-- man/my_first_fcn.Rd | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 man/my_first_fcn.Rd diff --git a/NAMESPACE b/NAMESPACE index 3548055f55..775aa64067 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -146,6 +146,7 @@ export(list_all_templates) export(list_tte_source_objects) export(max_cond) export(min_cond) +export(my_first_fcn) export(negate_vars) export(params) export(print_named_list) diff --git a/NEWS.md b/NEWS.md index 3383c0fe80..b6bc453e88 100644 --- a/NEWS.md +++ b/NEWS.md @@ -67,6 +67,8 @@ or that the queries dataset contains duplicates. (#2543) ## Documentation +- `my_first_fcn()` documentation updated to improve the clarity of the `@return` description, now stating: "A string with a welcome message 'Welcome to admiral!'". (#2593) + - `derive_locf_records()` documentation example was fixed to display LOCF records. (#2461) - The "Find my function" and "Presentation Archive"" links were made more prominent in the website navigation bar. (#2536) diff --git a/R/my_first_fcn.R b/R/my_first_fcn.R index 1002b1a50c..158542907e 100644 --- a/R/my_first_fcn.R +++ b/R/my_first_fcn.R @@ -2,9 +2,9 @@ #' #' This function outputs a welcome message for onboarding purposes. #' -#' @return A string with a welcome message. +#' @return A string with a welcome message "Welcome to admiral!" #' @export #' my_first_fcn <- function() { - "Welcome to the admiral family!" + "Welcome to admiral!" } diff --git a/man/my_first_fcn.Rd b/man/my_first_fcn.Rd new file mode 100644 index 0000000000..662dc97ff2 --- /dev/null +++ b/man/my_first_fcn.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/my_first_fcn.R +\name{my_first_fcn} +\alias{my_first_fcn} +\title{My First Function} +\usage{ +my_first_fcn() +} +\value{ +A string with a welcome message "Welcome to admiral!" +} +\description{ +This function outputs a welcome message for onboarding purposes. +} From 1f9937c192a002c50e98fb2f76b25ecb7925c5fd Mon Sep 17 00:00:00 2001 From: Lun-Hsien Chang Date: Wed, 18 Dec 2024 15:00:48 +1000 Subject: [PATCH 4/5] Updated R/my_first_fcn.R changing message from "Welcome to admiral\!" to "Welcome to the admiral family\!" --- R/my_first_fcn.R | 4 ++-- man/my_first_fcn.Rd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/my_first_fcn.R b/R/my_first_fcn.R index 158542907e..1c2770827c 100644 --- a/R/my_first_fcn.R +++ b/R/my_first_fcn.R @@ -2,9 +2,9 @@ #' #' This function outputs a welcome message for onboarding purposes. #' -#' @return A string with a welcome message "Welcome to admiral!" +#' @return A string with a welcome message #' @export #' my_first_fcn <- function() { - "Welcome to admiral!" + "Welcome to the admiral family!" } diff --git a/man/my_first_fcn.Rd b/man/my_first_fcn.Rd index 662dc97ff2..ef3bfa8708 100644 --- a/man/my_first_fcn.Rd +++ b/man/my_first_fcn.Rd @@ -7,7 +7,7 @@ my_first_fcn() } \value{ -A string with a welcome message "Welcome to admiral!" +A string with a welcome message } \description{ This function outputs a welcome message for onboarding purposes. From a24ecb887cf73302183d6b9ee89e132e69be61e4 Mon Sep 17 00:00:00 2001 From: Lun-Hsien Chang Date: Thu, 19 Dec 2024 12:01:04 +1000 Subject: [PATCH 5/5] Add 'onboarding' to spell check wordlist --- inst/WORDLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/inst/WORDLIST b/inst/WORDLIST index bdee907508..d2b27ccb4f 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -303,6 +303,7 @@ modularized msec nd occds +onboarding onwards parttime pharmaverse