Skip to content

Commit

Permalink
for CRAN, provide subsetting option in vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
krisrs1128 committed Sep 16, 2024
1 parent 4d7cf4c commit cec7a1d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
2 changes: 2 additions & 0 deletions R/lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ retrieve_names <- function(object, nm) {
#' mediation_data("PHQ", "treatment", starts_with("ASV"))
#' multimedia(exper) |>
#' edges()
#' @importFrom methods setGeneric
#' @export
setGeneric("edges", \(object) standardGeneric("edges"))

Expand Down Expand Up @@ -171,6 +172,7 @@ setGeneric("treatments<-", \(object, value) standardGeneric("treatments<-"))
#' mediation_data("PHQ", "treatment", starts_with("ASV"))
#' multimedia(exper) |>
#' mediators()
#' @importFrom methods setMethod
#' @export
setMethod(
"mediators", "multimedia",
Expand Down
5 changes: 2 additions & 3 deletions vignettes/IBD.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ knitr::opts_chunk$set(
)
knitr::knit_hooks$set(output = multimedia::ansi_aware_handler)
options(crayon.enabled = TRUE)
suppressPackageStartupMessages(library(ggplot2))
options(
ggplot2.discrete.colour = c(
Expand All @@ -38,7 +36,8 @@ options(
},
ggplot2.continuous.fill = function(...) {
scale_fill_distiller(palette = "Spectral", ...)
}
},
crayon.enabled = TRUE
)
th <- theme_classic() +
Expand Down
5 changes: 2 additions & 3 deletions vignettes/illustration.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ knitr::opts_chunk$set(
)
knitr::knit_hooks$set(output = multimedia::ansi_aware_handler)
options(crayon.enabled = TRUE)
suppressPackageStartupMessages(library(ggplot2))
options(
ggplot2.discrete.colour = c(
Expand All @@ -38,7 +36,8 @@ options(
},
ggplot2.continuous.fill = function(...) {
scale_fill_distiller(palette = "Spectral", ...)
}
},
crayon.enabled = TRUE
)
th <- theme_classic() +
Expand Down
20 changes: 13 additions & 7 deletions vignettes/mindfulness.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ vignette: >
%\VignetteIndexEntry{The Mindfulness Study}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
params:
subset: true
---

```{r setup, include = FALSE}
Expand All @@ -23,8 +25,6 @@ knitr::opts_chunk$set(
)
knitr::knit_hooks$set(output = multimedia::ansi_aware_handler)
options(crayon.enabled = TRUE)
suppressPackageStartupMessages(library(ggplot2))
options(
ggplot2.discrete.colour = c(
Expand All @@ -38,7 +38,8 @@ options(
},
ggplot2.continuous.fill = function(...) {
scale_fill_distiller(palette = "Spectral", ...)
}
},
crayon.enabled = TRUE
)
th <- theme_classic() +
Expand Down Expand Up @@ -81,6 +82,10 @@ library(tidyverse)
library(multimedia)
data(mindfulness)
set.seed(20231228)
if (params$subset) {
mindfulness <- prune_samples(c("sa1", "sa10", "sa20"), mindfulness)
}
```

This package needs a `mediation_data` object to organize the pretreatment,
Expand Down Expand Up @@ -131,8 +136,7 @@ outputs relative abundance profiles, all the estimated effects should be
interpreted on a probability scale.

```{r lnm_direct}
direct <- direct_effect(model, exper)
direct |>
direct <- direct_effect(model, exper) |>
group_by(outcome) |>
summarise(direct_effect = mean(direct_effect)) |>
arrange(-abs(direct_effect))
Expand Down Expand Up @@ -238,11 +242,13 @@ profile <- setup_profile(model, treatments(exper), treatments(exper))
y1 <- sample(model, profile = profile, pretreatment = pretreatments(exper))
y2 <- sample(
altered_direct,
profile = profile, pretreatment = pretreatments(exper)
profile = profile,
pretreatment = pretreatments(exper)
)
y3 <- sample(
altered_indirect,
profile = profile, pretreatment = pretreatments(exper)
profile = profile,
pretreatment = pretreatments(exper)
)
```

Expand Down
5 changes: 2 additions & 3 deletions vignettes/random.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ knitr::opts_chunk$set(
)
knitr::knit_hooks$set(output = multimedia::ansi_aware_handler)
options(crayon.enabled = TRUE)
suppressPackageStartupMessages(library(ggplot2))
options(
ggplot2.discrete.colour = c(
Expand All @@ -38,7 +36,8 @@ options(
},
ggplot2.continuous.fill = function(...) {
scale_fill_distiller(palette = "Spectral", ...)
}
},
crayon.enabled = TRUE
)
th <- theme_classic() +
Expand Down

0 comments on commit cec7a1d

Please sign in to comment.