Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GuangchuangYu committed Aug 21, 2024
1 parent e36abe9 commit 8b4c3a5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: yulab.utils
Title: Supporting Functions for Packages Maintained by 'YuLab-SMU'
Version: 0.1.6.003
Version: 0.1.6.004
Authors@R: c(person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6485-8781")))
Description: Miscellaneous functions commonly used by 'YuLab-SMU'.
Imports:
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# yulab.utils 0.1.6.003
# yulab.utils 0.1.6.004

+ `pkg_ref()` to access textVersion of package reference (2024-08-21, Wed)
+ export `str_detect()` (20024-08-19, Mon)
+ `user_dir()` to setup user data dir (20024-08-17, Sat)
+ `which_os()` to return the system name
Expand Down
17 changes: 16 additions & 1 deletion R/yulab-msg.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ yulab_msg <- function(pkgname = NULL, n = 1) {
} else if (id == 2) {
citation_msg <- random_ref(pkgname, ref_ggtree(), random_n = n)
} else {
citation_msg <- NULL
citation_msg <- pkg_ref(pkgname)
}

if (is.null(citation_msg)) return(header_msg)
Expand Down Expand Up @@ -83,6 +83,21 @@ random_ref <- function(pkgname, refs, random_n) {

}

pkg_ref <- function(pkgname) {
refs <- c(
fanyi =
paste("D Wang, G Chen, L Li, S Wen, Z Xie, X Luo, L Zhan, S Xu, J Li, R Wang, Q Wang, G Yu.",
"Reducing language barriers, promoting information absorption, and communication using fanyi.",
"Chinese Medical Journal. 2024, 137(16):1950-1956. doi: 10.1097/CM9.0000000000003242")
)

ref <- refs[pkgname]

if (is.null(ref)) return(NULL)

msg <- "Please cite:\n\n"
str_wrap(paste0(msg, refs, "\n"))
}



0 comments on commit 8b4c3a5

Please sign in to comment.