Skip to content

Commit

Permalink
Merge pull request #180 from sfcheung/devel
Browse files Browse the repository at this point in the history
Update to 0.2.3.7
  • Loading branch information
sfcheung authored Sep 28, 2024
2 parents 48199e3 + 89d8e88 commit 4e5242b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: manymome
Title: Mediation, Moderation and Moderated-Mediation After Model Fitting
Version: 0.2.3.5
Version: 0.2.3.7
Authors@R:
c(person(given = "Shu Fai",
family = "Cheung",
Expand Down
11 changes: 9 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# manymome 0.2.3.5
# manymome 0.2.3.7

## New Features

Expand All @@ -7,7 +7,7 @@
using `facet_grid()` to plot the
conditional effects when there are
two or more moderators in a path.
(0.2.3.3, 0.2.3.5)
(0.2.3.3, 0.2.3.5, 0.2.3.6)

## Improvement

Expand All @@ -28,6 +28,13 @@
such as when computing effects in a
moderation-only model. (0.2.3.4)

## Documentation

- Corrected `README` to remark that
dichotomous `x`-variables are supported
by most functions if coded as a
numeric dummy variable. (0.2.3.7)

## Bug Fixes

- Fixed an issue related to
Expand Down
6 changes: 6 additions & 0 deletions R/plotmod.R
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,17 @@ plot.cond_indirect_effects <- function(
if (!all(facet_grid_cols %in% w_names)) {
stop("'facet_grid_cols' must be among the moderators.")
}
if (length(facet_grid_cols) != 1) {
stop("Having more than one column in facet_grid is not yet supported.")
}
}
if (!is.null(facet_grid_rows)) {
if (!all(facet_grid_rows %in% w_names)) {
stop("'facet_grid_rows' must be among the moderators.")
}
if (length(facet_grid_rows) != 1) {
stop("Having more than one row in facet_grid is not yet supported.")
}
}
w_names_in <- setdiff(w_names, union(facet_grid_cols, facet_grid_rows))
if (length(w_names_in) == 0) {
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![R-CMD-check](https://github.com/sfcheung/manymome/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sfcheung/manymome/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

(Version 0.2.3.5, updated on 2024-09-28, [release history](https://sfcheung.github.io/manymome/news/index.html))
(Version 0.2.3.7, updated on 2024-09-28, [release history](https://sfcheung.github.io/manymome/news/index.html))

# manymome <img src="man/figures/logo.png" align="right" height="150" />

Expand Down Expand Up @@ -129,7 +129,15 @@ by multiple regression. The package was introduced in:
Despite the aforementioned advantages, the current version of
`manymome` has the following limitations:

- Does not (officially) support categorical predictors.
- Does not (officially) support
categorical `x`-variables with more
than two categories. Note that most
functions will work with dichotomous
`x`-variables, and the effect of `x`
is simply the difference in predicted
`y` between the two levels if coded as
0 and 1 (or any coding with a
difference of 1, e.g., 1 and 2).

- Does not support multilevel models (although `lavaan` does).

Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test_plot_cond_indirect_effects_2ws.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ test_that("Three moderators", {
expect_no_error(plot(out_1, graph_type = "tumble", facet_grid_rows = "gp", facet_grid_cols = "w4"))
expect_no_error(plot(out_1, graph_type = "tumble", facet_grid_rows = "w4", facet_grid_cols = "city"))
})

test_that("Three moderators", {
expect_error(plot(out_1, facet_grid_cols = c("gp", "w4")))
expect_error(plot(out_1, facet_grid_rows = c("gp", "w4")))
})

0 comments on commit 4e5242b

Please sign in to comment.