Skip to content

Commit f251a16

Browse files
author
Bruce
committed
[2025.11]
1 parent 44b7367 commit f251a16

15 files changed

Lines changed: 100 additions & 96 deletions

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: bruceR
22
Title: Broadly Useful Convenient and Efficient R Functions
3-
Version: 2025.8
4-
Date: 2025-08-15
3+
Version: 2025.11
4+
Date: 2025-11-24
55
Authors@R:
66
c(person(given = "Han Wu Shuang",
77
family = "Bao",
@@ -45,5 +45,5 @@ Suggests:
4545
cowplot, ggtext, see,
4646
car, lmtest, lme4, lmerTest, nnet, vars, phia, performance,
4747
MASS, MuMIn, BayesFactor, GGally, GPArotation
48-
RoxygenNote: 7.3.2
48+
RoxygenNote: 7.3.3
4949
Roxygen: list(markdown = TRUE)

NEWS.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
**Please check the [latest news (change log)](https://psychbruce.github.io/bruceR/news/index.html) and keep this package updated.**
22

3+
# bruceR 2025.11
4+
5+
- Fixed `theme_bruce()` for `ggplot2` (\>= 3.4.0) warnings about its deprecated features.
6+
37
# bruceR 2025.8
48

59
- Rewrote all help pages in the style of Roxygen markdown, and refined most of them.
@@ -314,7 +318,7 @@
314318
## Minor Changes
315319

316320
- Changed package title and description of `bruceR`: **BR**oadly **U**seful **C**onvenient and **E**fficient **R** functions that **BR**ing **U**sers **C**oncise and **E**legant **R** data analyses.
317-
- Reorganized [raw code files](https://github.com/psychbruce/bruceR/tree/master/R).
321+
- Reorganized [raw code files](https://github.com/psychbruce/bruceR/tree/main/R).
318322

319323
## Bug Fixes
320324

@@ -323,7 +327,7 @@
323327

324328
## Notes
325329

326-
- Deprecated some useless/defective functions (see [details](https://github.com/psychbruce/bruceR/blob/master/R/deprecated.R)).
330+
- Deprecated some useless/defective functions (see [details](https://github.com/psychbruce/bruceR/blob/main/R/deprecated.R)).
327331

328332
# bruceR 0.5.0 (Aug 2020)
329333

R/bruceR-stats_1_basic.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,6 @@ Describe = function(
424424
names(desc)[2] = "(NA)"
425425
nsmalls = c(0, 0, rep(digits, 8))
426426
}
427-
print_table(desc, digits=nsmalls, file=file,
428-
title="Descriptive Statistics:")
429427

430428
data.new = as.data.frame(data)
431429
vars.not.numeric = c()
@@ -437,8 +435,13 @@ Describe = function(
437435
}
438436
}
439437
}
440-
if(length(vars.not.numeric)>0)
441-
Print("\n\n\n<<yellow NOTE: `{paste(vars.not.numeric, collapse='`, `')}` transformed to numeric.>>")
438+
if(length(vars.not.numeric)>0) {
439+
Print("<<yellow NOTE: `{paste(vars.not.numeric, collapse='`, `')}` transformed to numeric.>>")
440+
cat("\n")
441+
}
442+
443+
print_table(desc, digits=nsmalls, file=file,
444+
title="Descriptive Statistics:")
442445

443446
p = NULL
444447
if(plot) {
@@ -643,7 +646,6 @@ Corr = function(
643646
if(p.adjust!="none")
644647
Print("<<blue <<italic p>> values and 95% CIs are adjusted using the \"{p.adjust}\" method.>>")
645648
print_table(COR, digits=0)
646-
cat("\n")
647649
} else {
648650
Print("Descriptive Statistics and Correlation Matrix:")
649651
cor.mat = matrix(formatF(cor$r, digits),
@@ -754,12 +756,10 @@ Corr = function(
754756
if(is.null(plot.file)) {
755757
if(p.adjust!="none")
756758
Print("<<blue <<italic p>> values ABOVE the diagonal are adjusted using the \"{p.adjust}\" method.>>")
757-
cat("\n")
758759
} else {
759760
ggsave(plot=p, filename=plot.file,
760761
width=plot.width, height=plot.height, dpi=plot.dpi)
761762
Print("<<green \u2714>> Plot saved to <<blue '{plot.file}'>>")
762-
cat("\n")
763763
}
764764

765765
invisible(list(corr=cor, plot=p))

R/bruceR-stats_5_advance.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ boot_ci = function(boot,
265265
#'
266266
#' # Software Comparison
267267
#'
268-
#' To perform mediation, moderation, and conditional process (moderated mediation) analyses, people may use [Mplus](http://www.statmodel.com/index.shtml), [SPSS "PROCESS" macro](https://www.processmacro.org/index.html), or [SPSS "MLmed" macro](https://njrockwood.com/mlmed/). Some R packages and functions can also perform such analyses, in a somewhat complex way, including [mediation::mediate()], [interactions::sim_slopes()], and [lavaan::sem()].
268+
#' To perform mediation, moderation, and conditional process (moderated mediation) analyses, people may use [Mplus](http://www.statmodel.com/index.shtml), [SPSS "PROCESS" macro](https://www.processmacro.org/index.html), or [SPSS "MLmed" macro](https://njrockwood.com/mlmed/). Some R packages and functions can also perform such analyses, in a somewhat complex way, including `mediation::mediate()`, `interactions::sim_slopes()`, and `lavaan::sem()`.
269269
#'
270270
#' Furthermore, some other R packages or scripts/modules have been developed, including [jamovi module `jAMM`](https://jamovi-amm.github.io/) (by *Marcello Gallucci*, based on the `lavaan` package), [R package `processR`](https://CRAN.R-project.org/package=processR) (by *Keon-Woong Moon*, not official, also based on the `lavaan` package), and [R script file "process.R"](https://www.processmacro.org/download.html) (the official PROCESS R code by *Andrew F. Hayes*, but it is not yet an R package).
271271
#'
@@ -1645,7 +1645,7 @@ process_mod = function(
16451645
#'
16461646
#' Tidy report of mediation analysis, which is performed using [mediation::mediate()].
16471647
#'
1648-
#' @param model Mediation model built with [mediation::mediate()].
1648+
#' @param model Mediation model built with `mediation::mediate()`.
16491649
#' @param digits Number of decimal places of output. Defaults to `3`.
16501650
#' @param file File name of MS Word (`".doc"`).
16511651
#'

R/bruceR-stats_6_plot.R

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' @param markdown Use `element_markdown()` instead of `element_text()`. Defaults to `FALSE`.
1616
#' If set to `TRUE`, then you should also use `element_markdown()` in `theme()` (if any).
1717
#' @param base.size Basic font size. Defaults to `12`.
18-
#' @param line.size Line width. Defaults to `0.5`.
18+
#' @param line.width Line width. Defaults to `0.5`.
1919
#' @param border `TRUE`, `FALSE`, or `"black"` (default).
2020
#' @param bg Background color of whole plot. Defaults to `"white"`.
2121
#' You can use any colors or choose from some pre-set color palettes:
@@ -72,7 +72,7 @@
7272
#' @export
7373
theme_bruce = function(
7474
markdown=FALSE,
75-
base.size=12, line.size=0.5,
75+
base.size=12, line.width=0.5,
7676
border="black",
7777
bg="white", panel.bg="white",
7878
tag="bold", plot.title="bold", axis.title="plain",
@@ -99,52 +99,52 @@ theme_bruce = function(
9999
if(!is.null(font)) grDevices::windowsFonts(FONT=grDevices::windowsFont(font))
100100
theme = theme_bw() +
101101
theme(
102-
# text=element_markdown(),
103-
# title=element_markdown(),
104-
# legend.text=element_markdown(size=base.size-2),
105-
# legend.title=element_markdown(size=base.size),
106-
panel.grid.minor=element_blank(),
107-
panel.grid.major.x=if(grid.x=="" | grid.x==FALSE) element_blank() else
108-
element_line(size=line.size, color=grid.x),
109-
panel.grid.major.y=if(grid.y=="" | grid.y==FALSE) element_blank() else
110-
element_line(size=line.size, color=grid.y),
111-
panel.border=if(border=="" | border==FALSE) element_blank() else
112-
element_rect(size=line.size+0.4, color=border, fill=NA),
113-
panel.background=element_rect(fill=panel.bg),
114-
axis.line=element_line(size=line.size, color="black"), # lineend="square"
115-
axis.title=element_text(size=base.size+2, color="black", face=axis.title),
116-
axis.title.x=element_text(margin=margin(0.5, 0, 0.4, 0, "lines")),
117-
axis.title.y=element_text(margin=margin(0, 0.5, 0, 0.4, "lines")),
118-
axis.ticks=element_line(size=line.size, color="black", lineend="square"),
119-
axis.ticks.length=unit(0.3, "lines"),
120-
axis.text=element_text(size=base.size, color="black"),
121-
axis.text.x=element_text(margin=margin(ifelse(tick.x, 0.5, 0.3), 0, 0, 0, "lines")),
122-
axis.text.y=element_text(margin=margin(0, ifelse(tick.y, 0.5, 0.3), 0, 0, "lines")),
123-
strip.background=element_rect(color=NA),
124-
strip.text=element_text(size=base.size-2),
125-
legend.title=element_text(size=base.size),
126-
legend.text=element_text(size=base.size-2),
127-
plot.title=element_text(size=base.size+2, face=plot.title, hjust=title.pos,
128-
margin=margin(0.2, 0, 0.6, 0, "lines")),
129-
plot.subtitle=element_text(size=base.size, face=plot.title, hjust=subtitle.pos,
130-
margin=margin(0, 0, 0.6, 0, "lines")),
131-
plot.caption=element_text(size=base.size-2, hjust=caption.pos,
132-
margin=margin(0, 0, 0.1, 0, "lines")),
133-
plot.tag=element_text(size=base.size+2, face=tag),
134-
plot.tag.position=c(0.005, 0.985),
135-
plot.background=element_rect(color=bg, fill=bg),
136-
plot.margin=margin(0.02, 0.02, 0.02, 0.02, "npc")
102+
# text = element_markdown(),
103+
# title = element_markdown(),
104+
# legend.text = element_markdown(size=base.size-2),
105+
# legend.title = element_markdown(size=base.size),
106+
panel.grid.minor = element_blank(),
107+
panel.grid.major.x = if(grid.x=="" | grid.x==FALSE) element_blank() else
108+
element_line(linewidth=line.width, color=grid.x),
109+
panel.grid.major.y = if(grid.y=="" | grid.y==FALSE) element_blank() else
110+
element_line(linewidth=line.width, color=grid.y),
111+
panel.border = if(border=="" | border==FALSE) element_blank() else
112+
element_rect(linewidth=line.width+0.4, color=border, fill=NA),
113+
panel.background = element_rect(fill=panel.bg),
114+
axis.line = element_line(linewidth=line.width, color="black"), # lineend="square"
115+
axis.title = element_text(size=base.size+2, color="black", face=axis.title),
116+
axis.title.x = element_text(margin=margin(0.5, 0, 0.4, 0, "lines")),
117+
axis.title.y = element_text(margin=margin(0, 0.5, 0, 0.4, "lines")),
118+
axis.ticks = element_line(linewidth=line.width, color="black", lineend="square"),
119+
axis.ticks.length = unit(0.3, "lines"),
120+
axis.text = element_text(size=base.size, color="black"),
121+
axis.text.x = element_text(margin=margin(ifelse(tick.x, 0.5, 0.3), 0, 0, 0, "lines")),
122+
axis.text.y = element_text(margin=margin(0, ifelse(tick.y, 0.5, 0.3), 0, 0, "lines")),
123+
strip.background = element_rect(color=NA),
124+
strip.text = element_text(size=base.size-2),
125+
legend.title = element_text(size=base.size),
126+
legend.text = element_text(size=base.size-2),
127+
plot.title = element_text(size=base.size+2, face=plot.title, hjust=title.pos,
128+
margin=margin(0.2, 0, 0.6, 0, "lines")),
129+
plot.subtitle = element_text(size=base.size, face=plot.title, hjust=subtitle.pos,
130+
margin=margin(0, 0, 0.6, 0, "lines")),
131+
plot.caption = element_text(size=base.size-2, hjust=caption.pos,
132+
margin=margin(0, 0, 0.1, 0, "lines")),
133+
plot.tag = element_text(size=base.size+2, face=tag),
134+
plot.tag.position = c(0.005, 0.985),
135+
plot.background = element_rect(color=bg, fill=bg),
136+
plot.margin = margin(0.02, 0.02, 0.02, 0.02, "npc")
137137
)
138138
if(!is.null(font))
139-
theme = theme + theme(text=element_text(family="FONT"))
139+
theme = theme + theme(text = element_text(family="FONT"))
140140
if((border!="" & border!=FALSE) | line.x==FALSE)
141-
theme = theme + theme(axis.line.x=element_blank())
141+
theme = theme + theme(axis.line.x = element_blank())
142142
if((border!="" & border!=FALSE) | line.y==FALSE)
143-
theme = theme + theme(axis.line.y=element_blank())
143+
theme = theme + theme(axis.line.y = element_blank())
144144
if(!tick.x)
145-
theme = theme + theme(axis.ticks.x=element_blank())
145+
theme = theme + theme(axis.ticks.x = element_blank())
146146
if(!tick.y)
147-
theme = theme + theme(axis.ticks.y=element_blank())
147+
theme = theme + theme(axis.ticks.y = element_blank())
148148
return(theme)
149149
}
150150

R/bruceR.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ if(FALSE) {
6666
#' - [Print()]
6767
#' - [Glue()]
6868
#' - [Run()]
69-
#' - [`%^%`]
70-
#' - [`%notin%`]
71-
#' - [`%allin%`]
72-
#' - [`%anyin%`]
73-
#' - [`%nonein%`]
74-
#' - [`%partin%`]
69+
#' - [`%^%`][bruceR::%^%]
70+
#' - [`%notin%`][bruceR::%notin%]
71+
#' - [`%allin%`][bruceR::%allin%]
72+
#' - [`%anyin%`][bruceR::%anyin%]
73+
#' - [`%nonein%`][bruceR::%nonein%]
74+
#' - [`%partin%`][bruceR::%partin%]
7575
#'
7676
#' ## 2. Multivariate Computation
7777
#'

R/bruceR_utils.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ data.table::`%notin%`
6161
#' @seealso
6262
#' [`%in%`][base::match]
6363
#'
64-
#' [`%anyin%`]
64+
#' [`%anyin%`][bruceR::%anyin%]
6565
#'
66-
#' [`%nonein%`]
66+
#' [`%nonein%`][bruceR::%nonein%]
6767
#'
68-
#' [`%partin%`]
68+
#' [`%partin%`][bruceR::%partin%]
6969
#'
7070
#' @examples
7171
#' 1:2 %allin% 1:3 # TRUE
@@ -87,11 +87,11 @@ data.table::`%notin%`
8787
#' @seealso
8888
#' [`%in%`][base::match]
8989
#'
90-
#' [`%allin%`]
90+
#' [`%allin%`][bruceR::%allin%]
9191
#'
92-
#' [`%nonein%`]
92+
#' [`%nonein%`][bruceR::%nonein%]
9393
#'
94-
#' [`%partin%`]
94+
#' [`%partin%`][bruceR::%partin%]
9595
#'
9696
#' @examples
9797
#' 3:4 %anyin% 1:3 # TRUE
@@ -113,11 +113,11 @@ data.table::`%notin%`
113113
#' @seealso
114114
#' [`%in%`][base::match]
115115
#'
116-
#' [`%allin%`]
116+
#' [`%allin%`][bruceR::%allin%]
117117
#'
118-
#' [`%anyin%`]
118+
#' [`%anyin%`][bruceR::%anyin%]
119119
#'
120-
#' [`%partin%`]
120+
#' [`%partin%`][bruceR::%partin%]
121121
#'
122122
#' @examples
123123
#' 3:4 %nonein% 1:3 # FALSE
@@ -140,11 +140,11 @@ data.table::`%notin%`
140140
#' @seealso
141141
#' [`%in%`][base::match]
142142
#'
143-
#' [`%allin%`]
143+
#' [`%allin%`][bruceR::%allin%]
144144
#'
145-
#' [`%anyin%`]
145+
#' [`%anyin%`][bruceR::%anyin%]
146146
#'
147-
#' [`%nonein%`]
147+
#' [`%nonein%`][bruceR::%nonein%]
148148
#'
149149
#' @examples
150150
#' "Bei" %partin% c("Beijing", "Shanghai") # TRUE

man/PROCESS.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/bruceR-package.Rd

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/grapes-allin-grapes.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)