diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 0b464399..b5c608b3 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -33,9 +33,11 @@ jobs: - name: Test coverage run: | + skip_fns = c("mssplot", "ssplot", "ssp", "plot.ssp", "ssplotM", "ssplotter") cov <- covr::package_coverage( quiet = FALSE, clean = FALSE, + function_exclusions = skip_fun install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") ) covr::to_cobertura(cov) diff --git a/NAMESPACE b/NAMESPACE index f2d4210b..3dfd244b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -118,6 +118,7 @@ importFrom(Rcpp,evalCpp) importFrom(Rcpp,loadModule) importFrom(TraMineR,alphabet) importFrom(TraMineR,seqdef) +importFrom(TraMineR,seqlegend) importFrom(TraMineR,seqstatf) importFrom(ggplot2,aes) importFrom(ggplot2,facet_wrap) diff --git a/R/stacked_sequence_plot.R b/R/stacked_sequence_plot.R index a9dd06ea..3505f1dd 100644 --- a/R/stacked_sequence_plot.R +++ b/R/stacked_sequence_plot.R @@ -150,7 +150,7 @@ stacked_sequence_plot <- function( if (n_channels == 1) { if (type == "distribution") { - cpal_y <- setNames(attr(y, "cpal"), attr(y, "labels")) + cpal_y <- stats::setNames(attr(y, "cpal"), attr(y, "labels")) p <- ggseqplot::ggseqdplot(y, group = group, sortv = sort_by, ...) + ggplot2::theme(legend.position = legend_position) + ggplot2::ylab("Proportion") + @@ -161,7 +161,7 @@ stacked_sequence_plot <- function( ) } if (type == "index") { - cpal_y <- setNames(attr(y, "cpal"), attr(y, "labels")) + cpal_y <- stats::setNames(attr(y, "cpal"), attr(y, "labels")) p <- ggseqplot::ggseqiplot(y, group = group, sortv = sort_by, ...) + ggplot2::theme(legend.position = legend_position) + ggplot2::ylab("Sequence") + @@ -189,7 +189,7 @@ stacked_sequence_plot <- function( p <- vector("list", n_channels) if (type == "distribution") { for (i in seq_len(n_channels)) { - cpal_y <- setNames(attr(y[[i]], "cpal"), attr(y[[i]], "labels")) + cpal_y <- stats::setNames(attr(y[[i]], "cpal"), attr(y[[i]], "labels")) p[[i]] <- ggseqplot::ggseqdplot(y[[i]], group = group, ...) + ggplot2::theme(legend.position = legend_position[i]) + ggplot2::ggtitle(channel_names[i]) + @@ -203,7 +203,7 @@ stacked_sequence_plot <- function( } if (type == "index") { for (i in seq_len(n_channels)) { - cpal_y <- setNames(attr(y[[i]], "cpal"), attr(y[[i]], "labels")) + cpal_y <- stats::setNames(attr(y[[i]], "cpal"), attr(y[[i]], "labels")) p[[i]] <- ggseqplot::ggseqiplot(y[[i]], group = group, ...) + ggplot2::theme(legend.position = legend_position[i]) + ggplot2::ggtitle(channel_names[i]) + diff --git a/man/sort_sequences.Rd b/man/sort_sequences.Rd index 276021b1..20efa45d 100644 --- a/man/sort_sequences.Rd +++ b/man/sort_sequences.Rd @@ -12,7 +12,8 @@ sort_sequences(x, sort_by = "start", sort_channel = 1, dist_method = "OM") \item{sort_by}{A character string specifying the sorting criterion.} \item{sort_channel}{An integer or character string specifying the channel to -sort by.} +sort by (unless \verb{sort_by = "mds} in which case all channels are used for +defining the sorting).} \item{dist_method}{A character string specifying the distance method to use.} } diff --git a/man/stacked_sequence_plot.Rd b/man/stacked_sequence_plot.Rd index 6a38911e..184c7542 100644 --- a/man/stacked_sequence_plot.Rd +++ b/man/stacked_sequence_plot.Rd @@ -44,7 +44,8 @@ are passed to \code{sortv} argument of \code{\link[ggseqplot:ggseqiplot]{ggseqpl \item{sort_channel}{Name of the channel which should be used for the sorting. Alternatively value \code{"Hidden states"} uses the hidden state -sequences for sorting. Default is to sort by the first channel in the data.} +sequences for sorting. Default is to sort by the first channel in the data. +If \code{sort_by = "mds"}, all channels are used for defining the sorting.} \item{dist_method}{The metric to be used for computing the distances of the sequences if multidimensional scaling is used for sorting. One of \code{"OM"}