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

ageShift: Return NA for mortalityTables without age shift

parent e6ec9ce1
Branches
Tags
No related merge requests found
...@@ -12,10 +12,18 @@ NULL ...@@ -12,10 +12,18 @@ NULL
#' ageShift(AVOe2005R.male.av, YOB=1910) #' ageShift(AVOe2005R.male.av, YOB=1910)
#' ageShift(AVOe2005R.male.av, YOB=1955) #' ageShift(AVOe2005R.male.av, YOB=1955)
#' ageShift(AVOe2005R.male.av, YOB=2010) #' ageShift(AVOe2005R.male.av, YOB=2010)
#' # A table with trend does NOT have any age shift, so NA is returned:
#' ageShift(AVOe2005R.male, YOB=1910)
#' #'
#' @exportMethod ageShift #' @exportMethod ageShift
setGeneric("ageShift", function(object, YOB=1975, ...) standardGeneric("ageShift")); setGeneric("ageShift", function(object, YOB=1975, ...) standardGeneric("ageShift"));
#' @describeIn ageShift Age shifts apply only to mortalityTagle.ageShift, so
#' all other tables return NA.
setMethod("ageShift", "mortalityTable", function(object, YOB, ...) {
NA
})
#' @describeIn ageShift Return the age shift of the age-shifted life table #' @describeIn ageShift Return the age shift of the age-shifted life table
#' given the birth year #' given the birth year
setMethod("ageShift", setMethod("ageShift",
......
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
\docType{methods} \docType{methods}
\name{ageShift} \name{ageShift}
\alias{ageShift} \alias{ageShift}
\alias{ageShift,mortalityTable-method}
\alias{ageShift,mortalityTable.ageShift-method} \alias{ageShift,mortalityTable.ageShift-method}
\title{Return the age shift of the age-shifted life table given the birth year} \title{Return the age shift of the age-shifted life table given the birth year}
\usage{ \usage{
ageShift(object, YOB = 1975, ...) ageShift(object, YOB = 1975, ...)
\S4method{ageShift}{mortalityTable}(object, YOB = 1975, ...)
\S4method{ageShift}{mortalityTable.ageShift}(object, YOB = 1975, ...) \S4method{ageShift}{mortalityTable.ageShift}(object, YOB = 1975, ...)
} }
\arguments{ \arguments{
...@@ -22,6 +25,9 @@ Return the age shift of the age-shifted life table given the birth year ...@@ -22,6 +25,9 @@ Return the age shift of the age-shifted life table given the birth year
} }
\section{Methods (by class)}{ \section{Methods (by class)}{
\itemize{ \itemize{
\item \code{mortalityTable}: Age shifts apply only to mortalityTagle.ageShift, so
all other tables return NA.
\item \code{mortalityTable.ageShift}: Return the age shift of the age-shifted life table \item \code{mortalityTable.ageShift}: Return the age shift of the age-shifted life table
given the birth year given the birth year
}} }}
...@@ -31,5 +37,7 @@ mortalityTables.load("Austria_Annuities") ...@@ -31,5 +37,7 @@ mortalityTables.load("Austria_Annuities")
ageShift(AVOe2005R.male.av, YOB=1910) ageShift(AVOe2005R.male.av, YOB=1910)
ageShift(AVOe2005R.male.av, YOB=1955) ageShift(AVOe2005R.male.av, YOB=1955)
ageShift(AVOe2005R.male.av, YOB=2010) ageShift(AVOe2005R.male.av, YOB=2010)
# A table with trend does NOT have any age shift, so NA is returned:
ageShift(AVOe2005R.male, YOB=1910)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment