Skip to content
Snippets Groups Projects
Commit 6ff0a6f1 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Add trend=TRUE parameter to plot.mortalityTable

This new argument allows the generic plog.mortalityTable to call plotMortalityTrend, if not set (or set to anything other than TRUE), the mortalities / death probabilities are plotted.
parent 06007cae
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,9 @@
#' @param reference The reference table that determines the 100\% values.
#' If not given, the absolute mortality values are
#' compared and plotted on a log-linear scale.
#' @param trend If set to \code{TRUE}, the function \code{\link{plotMortalityTrend}}
#' is used to plot the trends of the given tables.
#'
#'
#' @examples
#' # Load the Austrian census data
......@@ -55,9 +58,11 @@
#'
#' @import scales
#' @export
plot.mortalityTable = function(x, ..., reference=NULL) {
if (!missing(reference) && !is.null(reference)) {
plotMortalityTableComparisons(x, ..., reference=reference)
plot.mortalityTable = function(x, ..., reference = NULL, trend = FALSE) {
if (!missing(trend) && isTRUE(trend)) {
plotMortalityTrend(x, ..., reference = reference)
} else if (!missing(reference) && !is.null(reference)) {
plotMortalityTableComparisons(x, ..., reference = reference)
} else {
plotMortalityTables(x, ...)
}
......
......@@ -4,7 +4,7 @@
\alias{plot.mortalityTable}
\title{Plot multiple mortality tables (life tables) in one plot}
\usage{
\method{plot}{mortalityTable}(x, ..., reference = NULL)
\method{plot}{mortalityTable}(x, ..., reference = NULL, trend = FALSE)
}
\arguments{
\item{x}{First life table to be plotted. Must be a \code{mortalityTable}
......@@ -31,6 +31,9 @@ passed on to \code{\link{plotMortalityTables}} or
\item{reference}{The reference table that determines the 100\% values.
If not given, the absolute mortality values are
compared and plotted on a log-linear scale.}
\item{trend}{If set to \code{TRUE}, the function \code{\link{plotMortalityTrend}}
is used to plot the trends of the given tables.}
}
\description{
\code{plot.mortalityTable} displays multiple life tables (objects of child
......
......@@ -5,7 +5,7 @@
\title{Plot the trends of multiple mortality tables (life tables) in one chart}
\usage{
plotMortalityTrend(data, ..., xlim = NULL, ylim = NULL, xlab = NULL,
ylab = NULL, title = "", legend.position = c(0.9, 0.1),
ylab = NULL, title = "", legend.position = c(0.9, 0.9),
legend.key.width = unit(25, "mm"))
}
\arguments{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment