Skip to content

Commit

Permalink
Merge pull request #190 from sfcheung/devel
Browse files Browse the repository at this point in the history
0.2.3.14: Wrap the printout of computation formulas
  • Loading branch information
sfcheung authored Oct 2, 2024
2 parents dfd3019 + b21bae4 commit 23a9d8e
Show file tree
Hide file tree
Showing 5 changed files with 39 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.13
Version: 0.2.3.14
Authors@R:
c(person(given = "Shu Fai",
family = "Cheung",
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# manymome 0.2.3.13
# manymome 0.2.3.14

## New Features

Expand Down Expand Up @@ -52,6 +52,11 @@
`many_indirect_effects()` individually.
(0.2.3.12)

- Added `wrap_computation` to the argument
of `print.indirect()` to wrap the printout
of long computational formulas.
(0.2.3.14)

## Documentation and Notes

- Corrected `README` to remark that
Expand Down
26 changes: 24 additions & 2 deletions R/print_indirect.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
#' been computed. Default
#' to `TRUE`.
#'
#' @param wrap_computation Logical.
#' If `TRUE`, the default, long
#' computational symbols and values
#' will be wrapped to fit to the screen
#' width.
#'
#' @param ... Other arguments. Not used.
#'
Expand Down Expand Up @@ -214,6 +219,7 @@ print.indirect <- function(x,
se = NULL,
level = .95,
se_ci = TRUE,
wrap_computation = TRUE,
...) {
xold <- x
my_call <- x$call
Expand Down Expand Up @@ -487,7 +493,15 @@ print.indirect <- function(x,
# cat("\n", paste(x$op, x$computation_symbol, collapse = "\n"))
} else {
cat("\nComputation Formula:")
cat("\n ", x$computation_symbol)
if (wrap_computation) {
tmp <- strwrap(x$computation_symbol,
indent = 2,
exdent = 2)
cat("\n")
cat(tmp, sep = "\n")
} else {
cat("\n ", x$computation_symbol)
}
}
}
if (!is.null(x$computation_values)) {
Expand All @@ -496,7 +510,15 @@ print.indirect <- function(x,
# cat("\n", paste(x$op, x$computation_values, collapse = "\n"))
} else {
cat("\nComputation:")
cat("\n ", x$computation_values)
if (wrap_computation) {
tmp <- strwrap(x$computation_values,
indent = 2,
exdent = 2)
cat("\n")
cat(tmp, sep = "\n")
} else {
cat("\n ", x$computation_values)
}
}
}
if (has_ci) {
Expand Down
2 changes: 1 addition & 1 deletion 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.13, updated on 2024-09-30, [release history](https://sfcheung.github.io/manymome/news/index.html))
(Version 0.2.3.14, updated on 2024-10-02, [release history](https://sfcheung.github.io/manymome/news/index.html))

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

Expand Down
7 changes: 7 additions & 0 deletions man/print.indirect.Rd

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

0 comments on commit 23a9d8e

Please sign in to comment.