diff --git a/R/bruceR.R b/R/bruceR.R index d9c8abc..31ec8f5 100644 --- a/R/bruceR.R +++ b/R/bruceR.R @@ -70,34 +70,6 @@ if(FALSE) { #' #' Report bugs at \href{https://github.com/psychbruce/bruceR/issues}{GitHub Issues}. #' -#' @details -#' Loading \code{bruceR} by \code{library(bruceR)} will also load these R packages for you: -#' -#' \strong{[Data]:} -#' \itemize{ -#' \item \strong{\code{dplyr}}: Data manipulation and processing. -#' \item \strong{\code{tidyr}}: Data cleaning and reshaping. -#' \item \strong{\code{stringr}}: Toolbox for string operation (with regular expressions). -#' \item \strong{\code{forcats}}: Toolbox for factor manipulation (for categorical variables). -#' \item \strong{\code{data.table}}: Advanced \code{data.frame} with higher efficiency. -#' } -#' -#' \strong{[Stat]:} -#' \itemize{ -#' \item \strong{\code{emmeans}}: Estimates of marginal means and multiple contrasts. -#' \item \strong{\code{effectsize}}: Estimates of effect sizes and standardized parameters. -#' \item \strong{\code{performance}}: Estimates of regression models performance. -#' \item \strong{\code{lmerTest}}: Tests of linear mixed effects models (LMM, also known as HLM and multilevel models). -#' } -#' -#' \strong{[Plot]:} -#' \itemize{ -#' \item \strong{\code{ggplot2}}: Data visualization. -#' \item \strong{\code{ggtext}}: Markdown/HTML rich text format for \code{ggplot2} (geoms and themes). -#' \item \strong{\code{cowplot}}: Advanced toolbox for \code{ggplot2} (arrange multiple plots and add labels). -#' \item \strong{\code{see}}: Advanced toolbox for \code{ggplot2} (geoms, scales, themes, and color palettes). -#' } -#' #' @section Main Functions in \code{bruceR}: #' #' \describe{ @@ -216,13 +188,7 @@ if(FALSE) { #' } #' } #' -#' @author -#' \href{https://psychbruce.github.io}{Han-Wu-Shuang (Bruce) Bao} -#' -#' @docType package -#' @name bruceR-package -#' @aliases bruceR -NULL +"_PACKAGE" #### Package-Loading Information #### @@ -232,7 +198,8 @@ NULL #' @import ggplot2 #' @importFrom stats sd var cor median na.omit complete.cases #' @importFrom stats p.adjust pnorm pt pf pchisq qnorm qt quantile rnorm anova update terms drop1 -#' @importFrom stats lm coef confint residuals df.residual sigma as.formula terms.formula model.response model.frame +#' @importFrom stats lm coef confint residuals df.residual sigma +#' @importFrom stats as.formula terms.formula model.response model.frame #' @importFrom dplyr %>% select left_join sym group_by summarise mutate transmute across rename #' @importFrom data.table data.table is.data.table as.data.table #' @importFrom data.table := .BY .EACHI .GRP .I .N .NGRP .SD @@ -240,6 +207,7 @@ NULL ## Version Check new = FALSE inst.ver = as.character(utils::packageVersion("bruceR")) + pkg.date = substr(utils::packageDate("bruceR"), 1, 4) xml = suppressWarnings({ try({ readLines("https://cran.r-project.org/web/packages/bruceR/index.html") @@ -262,17 +230,11 @@ NULL ## Loaded Package pkgs = c( - ## DATA ## "dplyr", "tidyr", "stringr", "data.table", - ## STAT ## "emmeans", "effectsize", "performance", "lmerTest", "interactions", - ## PLOT ## - "ggplot2" # "ggtext", "cowplot", "see" + "ggplot2" ) - # suppressWarnings({ - # loaded = pacman::p_load(char=pkgs, character.only=TRUE, install=FALSE) - # }) suppressMessages({ suppressWarnings({ loaded = sapply(pkgs, require, character.only=TRUE) @@ -289,58 +251,62 @@ NULL # logo=sample(LOGO, 1) # yes: \u2714 \u221a # star: \u2605 - packageStartupMessage(Glue(" - \n - <> - <>oadly <>seful <>onvenient and <>fficient <> functions>> + packageStartupMessage(glue::glue_col(" + + {magenta bruceR (v{inst.ver})} + {blue Broadly Useful Convenient and Efficient R functions} - <> - <> + } - <> - <> + } - <> + {magenta For full functionality, please install all dependencies:} install.packages(\"bruceR\", dep=TRUE) - <> - <> - \n - ")) + {magenta Online documentation:} + {underline https://psychbruce.github.io/bruceR} + + {magenta To use this package in publications, please cite:} + Bao, H.-W.-S. ({pkg.date}). "), + glue::glue_col("{italic bruceR: Broadly useful convenient and efficient R functions}"), + glue::glue_col(" (Version {inst.ver}) [Computer software]. "), + glue::glue_col("{underline https://CRAN.R-project.org/package=bruceR}"), + "\n") } else { - packageStartupMessage(Glue(" - \n + packageStartupMessage(glue::glue_col(" + These R packages have not been installed: {paste(pkgs[loaded==FALSE], collapse=', ')} Please install them. - \n + ")) } ## Update Info if(new) - packageStartupMessage(Glue(" - \n + packageStartupMessage(glue::glue_col(" + NEWS: A new version of bruceR ({cran.ver}) is available ({cran.ymd})! - ************** Update ************** + ***** Please update ***** install.packages(\"bruceR\", dep=TRUE) - ************************************ - \n + ")) ## Check Dependencies @@ -353,15 +319,14 @@ check_depend = function(pkg) { deps = cc(pkgs[pkg, "Imports"], pkgs[pkg, "Suggests"]) need = deps[deps %notin% pkgs] if(length(need)>0) - packageStartupMessage(Glue(" - \n + packageStartupMessage(glue::glue_col(" + These packages are dependencies of `{pkg}` but not installed: - {paste(need, collapse=', ')} ***** Install all dependencies ***** install.packages(\"{pkg}\", dep=TRUE) - ************************************ - \n + ")) } diff --git a/README.md b/README.md index 3f9269f..f016e30 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This package includes easy-to-use functions for: -[![CRAN-Version](https://www.r-pkg.org/badges/version/bruceR?color=red)](https://CRAN.R-project.org/package=bruceR) [![GitHub-Version](https://img.shields.io/github/r-package/v/psychbruce/bruceR?label=GitHub&color=orange)](https://github.com/psychbruce/bruceR) [![R-CMD-check](https://github.com/psychbruce/bruceR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/psychbruce/bruceR/actions/workflows/R-CMD-check.yaml) [![CRAN-Downloads](https://cranlogs.r-pkg.org/badges/grand-total/bruceR)](https://CRAN.R-project.org/package=bruceR) [![Logo-Designer](https://img.shields.io/badge/Logo%20Designer-Meijia%20Li-blueviolet?logo=github-sponsors)](https://github.com/Stellapros) [![GitHub-Stars](https://img.shields.io/github/stars/psychbruce/bruceR?style=social)](https://github.com/psychbruce/bruceR/stargazers) +[![CRAN-Version](https://www.r-pkg.org/badges/version/bruceR?color=red)](https://CRAN.R-project.org/package=bruceR) [![GitHub-Version](https://img.shields.io/github/r-package/v/psychbruce/bruceR?label=GitHub&color=orange)](https://github.com/psychbruce/bruceR) [![R-CMD-check](https://github.com/psychbruce/bruceR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/psychbruce/bruceR/actions/workflows/R-CMD-check.yaml) [![CRAN-Downloads](https://cranlogs.r-pkg.org/badges/grand-total/bruceR)](https://CRAN.R-project.org/package=bruceR) [![GitHub-Stars](https://img.shields.io/github/stars/psychbruce/bruceR?style=social)](https://github.com/psychbruce/bruceR/stargazers) @@ -31,7 +31,7 @@ Han-Wu-Shuang (Bruce) Bao 包寒吴霜 ## Citation -- Bao, H.-W.-S. (2023). *bruceR: Broadly useful convenient and efficient R functions*. R package version 2023.8. +- Bao, H.-W.-S. (2023). *bruceR: Broadly useful convenient and efficient R functions* (Version 2023.8) [Computer software]. ## User Guide diff --git a/man/bruceR-package.Rd b/man/bruceR-package.Rd index 6a9f433..dcf87c9 100644 --- a/man/bruceR-package.Rd +++ b/man/bruceR-package.Rd @@ -2,8 +2,8 @@ % Please edit documentation in R/bruceR.R \docType{package} \name{bruceR-package} -\alias{bruceR-package} \alias{bruceR} +\alias{bruceR-package} \title{bruceR: \strong{BR}oadly \strong{U}seful \strong{C}onvenient and \strong{E}fficient \strong{R} functions} \description{ \strong{BR}oadly @@ -29,34 +29,6 @@ from GitHub: Report bugs at \href{https://github.com/psychbruce/bruceR/issues}{GitHub Issues}. } -\details{ -Loading \code{bruceR} by \code{library(bruceR)} will also load these R packages for you: - -\strong{[Data]:} -\itemize{ - \item \strong{\code{dplyr}}: Data manipulation and processing. - \item \strong{\code{tidyr}}: Data cleaning and reshaping. - \item \strong{\code{stringr}}: Toolbox for string operation (with regular expressions). - \item \strong{\code{forcats}}: Toolbox for factor manipulation (for categorical variables). - \item \strong{\code{data.table}}: Advanced \code{data.frame} with higher efficiency. -} - -\strong{[Stat]:} -\itemize{ - \item \strong{\code{emmeans}}: Estimates of marginal means and multiple contrasts. - \item \strong{\code{effectsize}}: Estimates of effect sizes and standardized parameters. - \item \strong{\code{performance}}: Estimates of regression models performance. - \item \strong{\code{lmerTest}}: Tests of linear mixed effects models (LMM, also known as HLM and multilevel models). -} - -\strong{[Plot]:} -\itemize{ - \item \strong{\code{ggplot2}}: Data visualization. - \item \strong{\code{ggtext}}: Markdown/HTML rich text format for \code{ggplot2} (geoms and themes). - \item \strong{\code{cowplot}}: Advanced toolbox for \code{ggplot2} (arrange multiple plots and add labels). - \item \strong{\code{see}}: Advanced toolbox for \code{ggplot2} (geoms, scales, themes, and color palettes). -} -} \section{Main Functions in \code{bruceR}}{ @@ -177,6 +149,15 @@ Loading \code{bruceR} by \code{library(bruceR)} will also load these R packages } } +\seealso{ +Useful links: +\itemize{ + \item \url{https://psychbruce.github.io/bruceR/} + \item Report bugs at \url{https://github.com/psychbruce/bruceR/issues} +} + +} \author{ -\href{https://psychbruce.github.io}{Han-Wu-Shuang (Bruce) Bao} +\strong{Maintainer}: Han-Wu-Shuang Bao \email{baohws@foxmail.com} (\href{https://orcid.org/0000-0003-3043-710X}{ORCID}) + }