|
| 1 | +#' @importFrom utils packageDescription |
| 2 | +#' @importFrom pillar style_subtle |
| 3 | +.onAttach <- function(libname, pkgname) { |
| 4 | + pkgVersion <- packageDescription(pkgname, fields="Version") |
| 5 | + msg <- paste0(pkgname, " v", pkgVersion, " ", |
| 6 | + "For help: https://github.com/YuLab-SMU/aplot/issues", "\n\n") |
| 7 | + |
| 8 | + citation <- paste0("If you use ", pkgname, |
| 9 | + " in published research, please cite the paper:\n\n", |
| 10 | + aplot_citations()) |
| 11 | + |
| 12 | + packageStartupMessage(paste0(strwrap(pillar::style_subtle(paste0(msg, citation, suppressmsg(pkgname)))), collapse="\n")) |
| 13 | +} |
| 14 | + |
| 15 | +aplot_citations <- function(){ |
| 16 | + paste("Shuangbin Xu, Qianwen Wang, Shaodi Wen, Junrui Li, Nan He, Ming Li, Thomas Hackl, Rui Wang, |
| 17 | + Dongqiang Zeng, Shixiang Wang, Shensuo Li, Chunhui Gao, Lang Zhou, Shaoguo Tao, Zijing Xie, |
| 18 | + Lin Deng, and Guangchuang Yu.", |
| 19 | + "aplot: Simplifying the creation of complex graphs to visualize associations across diverse data types.", |
| 20 | + "The Innovation. 2025, 6(9):100958. doi: 10.1016/j.xinn.2025.100958\n\n", |
| 21 | + "Export the citation to BibTex by citation('aplot')\n\n" |
| 22 | + ) |
| 23 | + |
| 24 | +} |
| 25 | + |
| 26 | +suppressmsg <- function(pkgname){ |
| 27 | + paste0("This message can be suppressed by:\n", |
| 28 | + "suppressPackageStartupMessages(library(", pkgname ,"))" |
| 29 | + ) |
| 30 | +} |
0 commit comments