Skip to content

Commit

Permalink
version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aalfons committed Nov 3, 2024
1 parent 94a2539 commit 418ebe9
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 87 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: robmedExtra
Type: Package
Title: Extra Functionality for (Robust) Mediation Analysis
Version: 0.1.2
Date: 2024-11-02
Version: 0.1.1
Date: 2024-11-03
Depends:
robmed (>= 0.10.0)
Imports:
Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Changes in robmed version 0.1.1

+ Added note in GUI that the resolution of the preview doesn't reflect the selected resolution for the png file.

+ Default in tables is now to include p values of the indirect effects.

+ Updated examples in help files.
19 changes: 9 additions & 10 deletions R/export_docx.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,18 @@
#' @examples
#' data("BSG2014")
#'
#' # seed to be used for the random number generator
#' seed <- 20211117
#'
#' # perform mediation analysis via robust bootstrap test ROBMED
#' set.seed(seed)
#' robust_boot <- test_mediation(BSG2014,
#' x = "ValueDiversity",
#' y = "TeamCommitment",
#' m = "TaskConflict",
#' robust = TRUE)
#' set.seed(20241101)
#' boot <- test_mediation(BSG2014,
#' x = "SharedLeadership",
#' y = "TeamPerformance",
#' m = c("ProceduralJustice",
#' "InteractionalJustice"),
#' covariates = c("AgeDiversity",
#' "GenderDiversity"))
#'
#' # construct flextable of results
#' ft <- to_flextable(robust_boot)
#' ft <- to_flextable(boot)
#'
#' # export to Microsoft Word
#' file_name <- tempfile(fileext = ".docx")
Expand Down
19 changes: 9 additions & 10 deletions R/export_pptx.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@
#' @examples
#' data("BSG2014")
#'
#' # seed to be used for the random number generator
#' seed <- 20211117
#'
#' # perform mediation analysis via robust bootstrap test ROBMED
#' set.seed(seed)
#' robust_boot <- test_mediation(BSG2014,
#' x = "ValueDiversity",
#' y = "TeamCommitment",
#' m = "TaskConflict",
#' robust = TRUE)
#' set.seed(20241101)
#' boot <- test_mediation(BSG2014,
#' x = "SharedLeadership",
#' y = "TeamPerformance",
#' m = c("ProceduralJustice",
#' "InteractionalJustice"),
#' covariates = c("AgeDiversity",
#' "GenderDiversity"))
#'
#' # construct flextable of results
#' ft <- to_flextable(robust_boot)
#' ft <- to_flextable(boot)
#'
#' # export to Microsoft Powerpoint
#' file_name <- tempfile(fileext = ".pptx")
Expand Down
37 changes: 20 additions & 17 deletions R/to_flextable.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#' data("BSG2014")
#'
#' # seed to be used for the random number generator
#' seed <- 20211117
#' seed <- 20150601
#'
#' # perform mediation analysis via robust bootstrap test ROBMED
#' set.seed(seed)
Expand All @@ -78,6 +78,10 @@
#' m = "TaskConflict",
#' robust = TRUE)
#'
#' # note that depending on the seed of the random number
#' # generator, the p value of the indirect effect may fall
#' # below or above the arbitrary 5% threshold
#'
#' # construct flextable of results
#' to_flextable(robust_boot)
#'
Expand Down Expand Up @@ -133,13 +137,13 @@ to_flextable.test_mediation <- function(object, type = c("boot", "data"), ...) {
#' @name to_flextable
#'
#' @param p_value a logical indicating whether to include p-values for the
#' indirect effects if mediation analysis was done via a bootstrap procedure
#' (defaults to \code{FALSE}). If \code{TRUE}, the p-values are obtained via
#' indirect effects if mediation analysis was done via a bootstrap procedure.
#' If \code{TRUE} (the default), the p-values are obtained via
#' \code{\link[robmed]{p_value}()}.
#'
#' @export

to_flextable.summary_test_mediation <- function(object, p_value = FALSE, ...) {
to_flextable.summary_test_mediation <- function(object, p_value = TRUE, ...) {
# call workhorse function to format tables for effects
tables <- get_mediation_tables(object, p_value = p_value, ...)
# put data frames of effects together
Expand All @@ -163,7 +167,7 @@ to_flextable.summary_test_mediation <- function(object, p_value = FALSE, ...) {
#'
#' @export

to_flextable.list <- function(object, type = c("boot", "data"), p_value = FALSE,
to_flextable.list <- function(object, type = c("boot", "data"), p_value = TRUE,
orientation = c("landscape", "portrait"), ...) {

# check arguments
Expand Down Expand Up @@ -293,22 +297,21 @@ to_flextable.list <- function(object, type = c("boot", "data"), p_value = FALSE,
#' @examples
#' data("BSG2014")
#'
#' # seed to be used for the random number generator
#' seed <- 20211117
#'
#' # perform mediation analysis via robust bootstrap test ROBMED
#' set.seed(seed)
#' robust_boot <- test_mediation(BSG2014,
#' x = "ValueDiversity",
#' y = "TeamCommitment",
#' m = "TaskConflict",
#' robust = TRUE)
#' set.seed(20150601)
#' boot <- test_mediation(BSG2014,
#' x = "ValueDiversity",
#' y = "TeamCommitment",
#' m = "TaskConflict")
#'
#' # construct flextable of results
#' ft <- to_flextable(robust_boot)
#' ft <- to_flextable(boot)
#' # add additional row to the footer
#' footer_line <- paste("Additional explanations on the conducted",
#' "analysis.")
#' footer_line <- flextable::as_paragraph(
#' "Depending on the seed of the random number generator, the ",
#' flextable::as_i("p"), " value of the indirect effect may ",
#' "fall below or above the arbitrary 5% threshold."
#' )
#' ft <- flextable::add_footer_lines(ft, values = footer_line)
#' ft <- theme_mediation(ft)
#' ft
Expand Down
14 changes: 9 additions & 5 deletions R/to_latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#' data("BSG2014")
#'
#' # seed to be used for the random number generator
#' seed <- 20211117
#' seed <- 20150601
#'
#' # perform mediation analysis via robust bootstrap test ROBMED
#' set.seed(seed)
Expand All @@ -97,6 +97,10 @@
#' m = "TaskConflict",
#' robust = TRUE)
#'
#' # note that depending on the seed of the random number
#' # generator, the p value of the indirect effect may fall
#' # below or above the arbitrary 5% threshold
#'
#' # construct LaTeX table of results
#' to_latex(robust_boot)
#'
Expand Down Expand Up @@ -152,8 +156,8 @@ to_latex.test_mediation <- function(object, type = c("boot", "data"), ...) {
#' @name to_latex
#'
#' @param p_value a logical indicating whether to include p-values for the
#' indirect effects if mediation analysis was done via a bootstrap procedure
#' (defaults to \code{FALSE}). If \code{TRUE}, the p-values are obtained via
#' indirect effects if mediation analysis was done via a bootstrap procedure.
#' If \code{TRUE} (the default), the p-values are obtained via
#' \code{\link[robmed]{p_value}()}.
#' @param align a character vector of length two. The first element is used
#' as the alignment specification in the \code{\\begin\{tabular\}\{\}}
Expand All @@ -167,7 +171,7 @@ to_latex.test_mediation <- function(object, type = c("boot", "data"), ...) {
#'
#' @export

to_latex.summary_test_mediation <- function(object, p_value = FALSE,
to_latex.summary_test_mediation <- function(object, p_value = TRUE,
align = c("lrrrr", "c"),
...) {
# TODO: add checks for argument 'align'
Expand All @@ -194,7 +198,7 @@ to_latex.summary_test_mediation <- function(object, p_value = FALSE,
#'
#' @export

to_latex.list <- function(object, type = c("boot", "data"), p_value = FALSE,
to_latex.list <- function(object, type = c("boot", "data"), p_value = TRUE,
orientation = c("landscape", "portrait"),
align = NULL, ...) {
# check argument for orientation
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To cite packages `robmed` and `robmedExtra` in publications, please use:

Alfons, A., Ates, N.Y., & Groenen, P.J.F. (2022b). Robust Mediation Analysis: The `R` Package `robmed`. *Journal of Statistical Software*, **103**(13), 1--45. doi: [10.18637/jss.v103.i13](https://doi.org/10.18637/jss.v103.i13).

Alfons A., Archimbaud A., & Drenth V. (2023). *`robmedExtra`: Extra Functionality for (Robust) Mediation Analysis*. `R` package, <https://CRAN.R-project.org/package=robmedExtra>.
Alfons A., & Archimbaud A. (2024). *`robmedExtra`: Extra Functionality for (Robust) Mediation Analysis*. `R` package, <https://CRAN.R-project.org/package=robmedExtra>.

## About ROBMED

Expand Down
19 changes: 9 additions & 10 deletions man/export_docx.Rd

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

19 changes: 9 additions & 10 deletions man/export_pptx.Rd

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

23 changes: 11 additions & 12 deletions man/theme_mediation.Rd

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

14 changes: 9 additions & 5 deletions man/to_flextable.Rd

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

14 changes: 9 additions & 5 deletions man/to_latex.Rd

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

0 comments on commit 418ebe9

Please sign in to comment.