R/autograph-defunct.R

Defines functions layout_tbl_graph_hexad layout_tbl_graph_pentad layout_tbl_graph_tetrad layout_tbl_graph_triad layout_tbl_graph_dyad layout_multilevel layout_alluvial layout_hierarchy plot.result.goldfish plot.changepoints.goldfish plot.diagnose_changepoints plot.outliers.goldfish plot.diagnose_outliers .ag_goldfish

Documented in layout_alluvial layout_hierarchy layout_multilevel layout_tbl_graph_dyad layout_tbl_graph_hexad layout_tbl_graph_pentad layout_tbl_graph_tetrad layout_tbl_graph_triad plot.changepoints.goldfish plot.diagnose_changepoints plot.diagnose_outliers plot.outliers.goldfish plot.result.goldfish

# Compatibility with older {goldfish} -----------------------------------------

# The goldfish overview draws each panel from a goldfish diagnostic, several of
# which arrived after the version on CRAN. Reaching them through
# `getExportedValue()` rather than `::` keeps `R CMD check` from resolving the
# call against whichever goldfish is installed and reporting the newer names as
# missing. Where the function really is missing the error this raises is caught
# by `gf_overview_try()`, which leaves that panel out, exactly as it does for a
# fit that stores no such primitive.
.ag_goldfish <- function(fn) {
  getExportedValue("goldfish", fn)
}

# The goldfish classes were renamed to a package prefix plus a noun, in
# camelCase (see the class naming rule in .github/CONTRIBUTING.md). Five old
# names keep an alias that forwards to the renamed method, so an object classed
# the way an earlier autograph expected still plots. `diagnose_outliers` and
# `diagnose_changepoints` are the names goldfish 1.9.21 stamps;
# `outliers.goldfish` and `changepoints.goldfish` are the two the draft methods
# were written against before that; `result.goldfish` is the fit class every
# goldfish stamps, back to the version on CRAN, so it is the alias that reaches
# the most users. Nothing is aliased for the classes only the renamed goldfish
# emits, since nothing ever stamped those.
#
# An alias restores dispatch, not the old column contract: each forwards to a
# method that reads the current columns (`.series`, and a logical `outlier` or
# `cpt`), so an object carrying the pre-1.9.21 shape still fails on its columns.
# Delete each alias once the oldest goldfish autograph works with is past the
# rename.

#' @rdname plot_adequacy
#' @details
#'   `plot.diagnose_outliers()`, `plot.outliers.goldfish()`,
#'   `plot.diagnose_changepoints()` and `plot.changepoints.goldfish()` are
#'   aliases for `plot.goldfishOutliers()` and `plot.goldfishChangepoints()`,
#'   kept so that an object carrying one of the older class names plots as
#'   before. Each reads the columns the current methods read. They will be
#'   removed.
#' @method plot diagnose_outliers
#' @export
plot.diagnose_outliers <- function(x, ...) {
  plot.goldfishOutliers(x, ...)
}

#' @rdname plot_adequacy
#' @method plot outliers.goldfish
#' @export
plot.outliers.goldfish <- function(x, ...) {
  plot.goldfishOutliers(x, ...)
}

#' @rdname plot_adequacy
#' @method plot diagnose_changepoints
#' @export
plot.diagnose_changepoints <- function(x, ...) {
  plot.goldfishChangepoints(x, ...)
}

#' @rdname plot_adequacy
#' @method plot changepoints.goldfish
#' @export
plot.changepoints.goldfish <- function(x, ...) {
  plot.goldfishChangepoints(x, ...)
}

#' @rdname plot_goldfish_fit
#' @details
#'   `plot.result.goldfish()` is an alias for `plot.goldfishFit()`, kept so that
#'   a fit from a goldfish that still stamps the old class name plots as before.
#'   It will be removed.
#' @method plot result.goldfish
#' @export
plot.result.goldfish <- function(x, ..., effects = 4) {
  plot.goldfishFit(x, ..., effects = effects)
}


# Layouts -----------------------------------------------------------------

#' Deprecated layout names
#'
#' @description
#'   Each of these draws what its replacement draws, after saying so.
#'   They are kept so that a call naming the older layout still draws,
#'   and will be removed.
#'
#'   - "hierarchy" is now "layered", which is what the layout does to a
#'     two-mode network, where the two modes are two layers and neither is
#'     above the other in any hierarchy.
#'   - "alluvial" is now "lineage". The name is held for a plot of changing
#'     membership composition over time.
#'   - "multilevel" is now "levels", which `{graphlayouts}` does not also use.
#'   - "dyad", "triad", "tetrad", "pentad" and "hexad" are now all
#'     "configuration", which already picks the one matching the number of
#'     nodes. The functions of those names are not deprecated.
#'
#'   Note that `.deprecated_layouts()` lists these, so that neither the
#'   completions nor the functional audit offers a retired name.
#' @name layout_deprecated
#' @param .data Some `{manynet}` compatible network data.
#' @param ... Arguments passed on to the replacement layout.
#' @returns Returns a table of nodes' x and y coordinates.
#' @keywords internal
NULL

#' @rdname layout_deprecated
#' @export
layout_hierarchy <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val hierarchy} layout is deprecated.",
    "Please use {.code layout = \"layered\"} instead, which draws the same networks the same way.")
  layout_layered(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_hierarchy <- layout_hierarchy

#' @rdname layout_deprecated
#' @export
layout_alluvial <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val alluvial} layout is deprecated.",
    "Please use {.code layout = \"lineage\"} instead, which draws the same networks the same way.")
  layout_lineage(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_alluvial <- layout_alluvial

#' @rdname layout_deprecated
#' @export
layout_multilevel <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val multilevel} layout is deprecated.",
    "Please use {.code layout = \"levels\"} instead, which takes the same {.arg level} argument.")
  layout_levels(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_multilevel <- layout_multilevel

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_dyad <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val dyad} layout is deprecated.",
    "Please use {.code layout = \"configuration\"} instead,",
    "which draws whichever configuration the network has nodes for.",
    "The {.fn layout_dyad} function itself is not deprecated.")
  layout_configuration(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_triad <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val triad} layout is deprecated.",
    "Please use {.code layout = \"configuration\"} instead,",
    "which draws whichever configuration the network has nodes for.",
    "The {.fn layout_triad} function itself is not deprecated.")
  layout_configuration(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_tetrad <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val tetrad} layout is deprecated.",
    "Please use {.code layout = \"configuration\"} instead,",
    "which draws whichever configuration the network has nodes for.",
    "The {.fn layout_tetrad} function itself is not deprecated.")
  layout_configuration(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_pentad <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val pentad} layout is deprecated.",
    "Please use {.code layout = \"configuration\"} instead,",
    "which draws whichever configuration the network has nodes for.",
    "The {.fn layout_pentad} function itself is not deprecated.")
  layout_configuration(.data, ...)
}

#' @rdname layout_deprecated
#' @export
layout_tbl_graph_hexad <- function(.data, ...) {
  manynet::snet_warn(
    "The {.val hexad} layout is deprecated.",
    "Please use {.code layout = \"configuration\"} instead,",
    "which draws whichever configuration the network has nodes for.",
    "The {.fn layout_hexad} function itself is not deprecated.")
  layout_configuration(.data, ...)
}

Try the autograph package in your browser

Any scripts or data that you put into this service are public.

autograph documentation built on Nov. 16, 2026, 5:08 p.m.