Skip to content

Commit 1110626

Browse files
authored
Merge branch 'main' into new_vignette
2 parents fea2ba2 + a8bd32b commit 1110626

File tree

191 files changed

+11808
-2522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+11808
-2522
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@
2828
\.code-workspace$
2929
^\.lintr$
3030
^tests/testthat/_snaps/.
31+
^GEMINI\.md$

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ name: R-CMD-check
1212

1313
jobs:
1414
R-CMD-check:
15-
uses: easystats/workflows/.github/workflows/R-CMD-check.yaml@main
15+
uses: easystats/workflows/.github/workflows/R-CMD-check-no-oldrel.yaml@main

.github/workflows/check-styling.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow derived from https://github.com/posit-dev/setup-air/tree/main/examples
2+
3+
on:
4+
# Using `pull_request_target` over `pull_request` for elevated `GITHUB_TOKEN`
5+
# privileges, otherwise we can't set `pull-requests: write` when the pull
6+
# request comes from a fork, which is our main use case (external contributors).
7+
#
8+
# `pull_request_target` runs in the context of the target branch (`main`, usually),
9+
# rather than in the context of the pull request like `pull_request` does. Due
10+
# to this, we must explicitly checkout `ref: ${{ github.event.pull_request.head.sha }}`.
11+
# This is typically frowned upon by GitHub, as it exposes you to potentially running
12+
# untrusted code in a context where you have elevated privileges, but they explicitly
13+
# call out the use case of reformatting and committing back / commenting on the PR
14+
# as a situation that should be safe (because we aren't actually running the untrusted
15+
# code, we are just treating it as passive data).
16+
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
17+
pull_request_target:
18+
19+
name: format-suggest.yaml
20+
21+
jobs:
22+
format-suggest:
23+
name: format-suggest
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
# Required to push suggestion comments to the PR
28+
pull-requests: write
29+
30+
steps:
31+
- uses: actions/checkout@v6
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha }}
34+
35+
- name: Install
36+
uses: posit-dev/setup-air@v1
37+
38+
- name: Format
39+
run: air format .
40+
41+
- name: Suggest
42+
uses: reviewdog/action-suggester@v1
43+
with:
44+
level: error
45+
fail_level: error
46+
tool_name: air

.github/workflows/lint-changed-files.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/lint.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/revdepcheck.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

DESCRIPTION

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: modelbased
33
Title: Estimation of Model-Based Predictions, Contrasts and Means
4-
Version: 0.12.0.1
4+
Version: 0.14.0
55
Authors@R:
66
c(person(given = "Dominique",
77
family = "Makowski",
@@ -37,12 +37,12 @@ License: GPL-3
3737
URL: https://easystats.github.io/modelbased/
3838
BugReports: https://github.com/easystats/modelbased/issues
3939
Depends:
40-
R (>= 3.6)
40+
R (>= 4.0)
4141
Imports:
42-
bayestestR (>= 0.16.1),
43-
datawizard (>= 1.1.0),
44-
insight (>= 1.3.1),
45-
parameters (>= 0.27.0),
42+
bayestestR (>= 0.17.0),
43+
datawizard (>= 1.3.0),
44+
insight (>= 1.4.4),
45+
parameters (>= 0.28.3),
4646
graphics,
4747
stats,
4848
tools,
@@ -58,6 +58,7 @@ Suggests:
5858
coda,
5959
collapse,
6060
correlation,
61+
coxme,
6162
curl,
6263
discovr,
6364
easystats,
@@ -67,15 +68,16 @@ Suggests:
6768
gamm4,
6869
gganimate,
6970
ggplot2,
70-
glmmTMB,
71+
glmmTMB (>= 1.1.12),
7172
httr2,
7273
knitr,
7374
lme4,
7475
lmerTest,
7576
logspline,
7677
MASS,
78+
MatchIt,
7779
Matrix,
78-
marginaleffects (>= 0.26.0),
80+
marginaleffects (>= 0.29.0),
7981
mice,
8082
mgcv,
8183
mvtnorm,
@@ -89,22 +91,26 @@ Suggests:
8991
poorman,
9092
pscl,
9193
RcppEigen,
94+
Rdatasets,
9295
report,
9396
rmarkdown,
9497
rstanarm,
9598
rtdists,
9699
RWiener,
97100
sandwich,
101+
scales,
98102
see (>= 0.11.0),
99103
survival,
100104
testthat (>= 3.2.1),
105+
tinyplot (>= 0.6.0),
106+
tinytable,
101107
vdiffr,
102108
withr
103109
VignetteBuilder:
104110
knitr
105111
Encoding: UTF-8
106112
Language: en-US
107-
RoxygenNote: 7.3.2
113+
RoxygenNote: 7.3.3
108114
Config/testthat/edition: 3
109115
Config/testthat/parallel: true
110116
Roxygen: list(markdown = TRUE)

GEMINI.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# R Project Coding Conventions for easystats
2+
3+
This document outlines the common coding conventions observed in the `easystats` R projects.
4+
5+
## File Naming
6+
7+
* Files are named with `snake_case` and should correspond to the main function they contain (e.g., `check_normality.R`).
8+
9+
## Package versioning
10+
11+
* Package versions follow Semantic Versioning conventions.
12+
13+
* If pull requests include user-visible changes, the "developer" version number should be increased (e.g. from 0.10.1.5 to 0.10.1.6). This ensures that `easystats::install_latest()` will download the latest versions.
14+
15+
## Code Style & Formatting
16+
17+
* **Assignment:** Use the `<-` operator for assignment, not `=`.
18+
* **Spacing:**
19+
* Use spaces around all infix operators (`<-`, `==`, `+`, etc.).
20+
* Place a space after a comma, but not before.
21+
* **Curly Braces:**
22+
* For function definitions, the opening `{` should be on its own line.
23+
* For `if`/`else` statements, the opening `{` can be on the same line.
24+
* **Line Length:** Keep lines to a reasonable length (e.g., under 80-100 characters) to improve readability.
25+
26+
## Function Naming
27+
28+
* **Public Functions:** Use lower case, underscore separated if more than one verb, i.e. `snake_case` (e.g., `check_normality()`, `model_performance()`). These functions should be exported.
29+
* **Internal Functions:** Prefix with a dot (`.`) and may use `snake_case` or `camelCase` (e.g., `.safe()`, `.get_BIC()`, `.check_normality()`). These functions should not be exported.
30+
* **Naming**: Common prefix for functions that focus on specific "tasks" or workflows (e.g. in package "insight", `get_*()` to get data, `find_*()` to find information, or in package "performance", `performance_*()` to compute measures of model quality, `check_*()` to check model assumptions...).
31+
32+
## Argument names
33+
34+
* Lower case, underscore separated if more than one verb.
35+
* Arguments that refer to plot or table aesthetics (like size or alpha of geoms) should follow the pattern `aesthetics_geomtype`, e.g. `size_point`, `color_line` or `alpha_rope`.
36+
* "easystats" uses the argument name `by` to indicate grouping, not `group_by` or `at`.
37+
* Use `select` and `exclude` to select columns/variables, and `keep` or `drop` to select rows/observations.
38+
* Handling NA values, especially removing missing values, is done with `remove_na`.
39+
40+
## Element / Column names (for returned data frames)
41+
42+
1) First letter of the column name is capital, unless (6) applies (*example:* `Parameter`).
43+
2) First letter of nouns is capital, unless (6) applies (*example:* `ROPE_Percentage`, `Prior_Scale`).
44+
3) Using underscore rather than camelCase to separate words (*example:* `CI_high`).
45+
4) Multiple words: common/main part first and adjective/specifier/variational part after, unless (8) applies (*example:* `Median_standardized`, `ROPE_percentage`).
46+
5) Abbreviations: all uppercase (*example:* `ESS`, `MCSE`, `ROPE`).
47+
6) Keep conventions for reserved words (*example:* `p`, `pd`, `Rhat`).
48+
7) Adjectives / verbs: all lower case, unless (1) applies (*example:* `high` or `low` in `CI_high` or `CI_low`).
49+
8) In case of multiple occurrences of column names that indicate the same measure or content (like `CI_low` or `SE`), the common part is appended as suffix to the context specific part (*example:* `CI_low` and `Eta2_partial_CI_low`, and **not** `CI_low` and `CI_low_Eta2_partial`).
50+
9) The "squared" term in column names that refers to "common" statistics (`Eta2`, `Chi2`, `Omega2`, ...) should be written as `2`, not `sq`, `squared` or `pétit-deux` (*example:* `Chi2`, and **not** `Chisq`, `Eta2`, and **not** `Eta_squared`). This rule does **not** apply to function names.
51+
10) Converting between "easystats" style and "broom" style can be done with `insight::standardize_names()`.
52+
53+
## Documentation (roxygen2)
54+
55+
All exported functions must be documented using `roxygen2`-style comments (`#'`). The documentation should include:
56+
57+
* **Title:** A concise, one-line summary of what the function does.
58+
* **Description:** A more detailed paragraph explaining the function's purpose.
59+
* **`@param`:** A description for each function parameter.
60+
* **`@return`:** A description of the value the function returns.
61+
* **`@export`:** Tag to make the function available to users.
62+
* **`@examples` or `@examplesIf`:** Code demonstrating how to use the function.
63+
* **`@seealso`:** (Optional) Links to related functions.
64+
* **`@details`:** (Optional) Further details on the methodology or implementation.
65+
66+
## Dependencies
67+
68+
* Use base-R wherever possible (to reduce hard dependencies)
69+
* Make sure R-version requirements are not too strict
70+
* **Package Functions:** Always use the `::` operator to call functions from other packages (e.g., `stats::shapiro.test`, `insight::model_info`). Do not use `library()` or `require()` at the top of a file (no full import, only selective import of functions).
71+
* **Conditional Checks:** Use `insight::check_if_installed("pkg_name")` to check if a package is available before using it, especially for optional ("Suggests") dependencies.
72+
73+
## S3 Object System
74+
75+
* The projects make extensive use of the S3 object-oriented system.
76+
* **Generic Functions:** Define generic functions using `UseMethod("function_name")`.
77+
* **Methods:** Implement methods for specific object classes using the `function_name.class_name` naming convention (e.g., `check_normality.default`, `model_performance.lm`).
78+
79+
## Error Handling and Messaging
80+
81+
* Use `tryCatch` for operations that might fail. The internal `.safe()` helper is a good example.
82+
* Use the `insight` package's functions for user-facing messages:
83+
* `insight::format_error()`
84+
* `insight::format_warning()`
85+
* `insight::format_alert()`
86+
* `insight::print_color()`

NAMESPACE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(as.data.frame,estimate_contrasts)
4+
S3method(as.data.frame,estimate_means)
5+
S3method(as.data.frame,estimate_predicted)
6+
S3method(as.data.frame,estimate_slopes)
37
S3method(describe_nonlinear,data.frame)
48
S3method(describe_nonlinear,estimate_predicted)
59
S3method(describe_nonlinear,numeric)
@@ -56,6 +60,10 @@ S3method(print_md,visualisation_matrix)
5660
S3method(reshape_grouplevel,data.frame)
5761
S3method(reshape_grouplevel,default)
5862
S3method(reshape_grouplevel,estimate_grouplevel)
63+
S3method(residualize_over_grid,data.frame)
64+
S3method(residualize_over_grid,default)
65+
S3method(residualize_over_grid,estimate_means)
66+
S3method(residualize_over_grid,estimate_predicted)
5967
S3method(smoothing,data.frame)
6068
S3method(smoothing,numeric)
6169
S3method(standardize,estimate_contrasts)
@@ -64,13 +72,18 @@ S3method(standardize,estimate_predicted)
6472
S3method(standardize,estimate_slopes)
6573
S3method(summary,estimate_slopes)
6674
S3method(summary,reshape_grouplevel)
75+
S3method(tinyplot::tinyplot,estimate_grouplevel)
76+
S3method(tinyplot::tinyplot,estimate_means)
77+
S3method(tinyplot::tinyplot,estimate_predicted)
78+
S3method(tinyplot::tinyplot,estimate_slopes)
6779
S3method(unstandardize,estimate_contrasts)
6880
S3method(unstandardize,estimate_means)
6981
S3method(unstandardize,estimate_predicted)
7082
S3method(visualisation_recipe,estimate_grouplevel)
7183
S3method(visualisation_recipe,estimate_means)
7284
S3method(visualisation_recipe,estimate_predicted)
7385
S3method(visualisation_recipe,estimate_slopes)
86+
export(collapse_by_group)
7487
export(describe_nonlinear)
7588
export(display)
7689
export(estimate_contrasts)
@@ -95,6 +108,7 @@ export(pool_slopes)
95108
export(print_html)
96109
export(print_md)
97110
export(reshape_grouplevel)
111+
export(residualize_over_grid)
98112
export(smoothing)
99113
export(standardize)
100114
export(unstandardize)

0 commit comments

Comments
 (0)