Skip to content

Commit

Permalink
updated pkg info
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce committed Aug 21, 2023
1 parent 27994ea commit 97e68f2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 102 deletions.
105 changes: 35 additions & 70 deletions R/bruceR.R
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 ####
Expand All @@ -232,14 +198,16 @@ 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
.onAttach = function(libname, pkgname) {
## 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")
Expand All @@ -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)
Expand All @@ -289,58 +251,62 @@ NULL
# logo=sample(LOGO, 1)
# yes: \u2714 \u221a
# star: \u2605
packageStartupMessage(Glue("
\n
<<magenta bruceR (v{inst.ver})>>
<<blue <<underline BR>>oadly <<underline U>>seful <<underline C>>onvenient and <<underline E>>fficient <<underline R>> functions>>
packageStartupMessage(glue::glue_col("
{magenta bruceR (v{inst.ver})}
{blue Broadly Useful Convenient and Efficient R functions}
<<magenta Packages also loaded:>>
<<green
{magenta Packages also loaded:}
{green
\u2714 data.table\t\u2714 emmeans
\u2714 dplyr \t\u2714 lmerTest
\u2714 tidyr \t\u2714 effectsize
\u2714 stringr \t\u2714 performance
\u2714 ggplot2 \t\u2714 interactions
>>
}
<<magenta Main functions of `bruceR`:>>
<<cyan
{magenta Main functions of `bruceR`:}
{cyan
cc() \tDescribe() \tTTEST()
add() \tFreq() \tMANOVA()
.mean() \tCorr() \tEMMEANS()
set.wd() \tAlpha() \tPROCESS()
import() \tEFA() \tmodel_summary()
print_table() \tCFA() \tlavaan_summary()
>>
}
<<magenta For full functionality, please install all dependencies:>>
{magenta For full functionality, please install all dependencies:}
install.packages(\"bruceR\", dep=TRUE)
<<magenta Online documentation:>>
<<underline https://psychbruce.github.io/bruceR>>
\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
Expand All @@ -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
"))
}

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This package includes easy-to-use functions for:

<!-- badges: start -->

[![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)

<!-- badges: end -->

Expand All @@ -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. <https://CRAN.R-project.org/package=bruceR>
- Bao, H.-W.-S. (2023). *bruceR: Broadly useful convenient and efficient R functions* (Version 2023.8) [Computer software]. <https://CRAN.R-project.org/package=bruceR>

## User Guide

Expand Down
41 changes: 11 additions & 30 deletions man/bruceR-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 97e68f2

Please sign in to comment.