% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/500_ylt_long2short.R
\name{ylt_long2short}
\alias{ylt_long2short}
\title{Calculate a Short YLT from a Long YLT}
\usage{
ylt_long2short(
  longylt,
  nyearsinylt = 0,
  zeroeventyearsincluded = TRUE,
  verbose = FALSE
)
}
\arguments{
\item{longylt}{A data frame containing the long YLT}

\item{nyearsinylt}{Sometimes, by chance, the long YLT might not have any
events in year 100, even
though technically it's supposed to be 100 years long. So it's good to specify
the number of actual years (in this example, 100). Then the short YLT will have
100 years in it. The last year just won't have any events in it. If you just leave
this to the default value of 0, then the short YLT will just stop at the last year
in the long YLT.}

\item{zeroeventyearsincluded}{What if year 17 doesn't have any events in it? Should
it be included in the short YLT? Yes, it should. And that's the default.
But if you set this to FALSE, then that year will not be included.}

\item{verbose}{If you set this to true, you get some nice information about the
number of years, etc.}
}
\value{
A data frame containing the short YLT, with columns
\code{year}, \code{longylt_start_row}, \code{nevents_in_year},
\code{loss_in_year}, \code{max_loss_in_year}.
Note that if there are years that are missing from the long YLT because they
don't contain any events, they will be listed as start_row=NA, nevents=0.
You might think I could just put the start now, not NA.
But if this is the last year, you need NA, because there is no row in the long YLT.
}
\description{
Calculates a Short YLT from a Long YLT.
Requires \code{year} and \code{loss}.
Assumes that the \code{year} should start from 1 (if there is an event in the first year).
Assumes that the years are in order.
The short YLT output includes years that have no events in the long YLT input.
The example shows how to combine them to make a full YLT.
}
\examples{
#
# 1 create a long YLT with cat
#
cat("1. make the longylt:\n")
year=c(1,1,1,2,4,5,6,7,8,8)
loss=seq(10,55,5)
cat=c(1,2,3,4,5,6,7,8,9,10)
longylt=data.frame(year,loss,cat)
print(longylt)
#
# 2 make the shortylt
#
cat("2. make the shortylt:\n")
shortylt=ylt_long2short(longylt,nyearsinylt=10)
print(shortylt)


}
\author{
Stephen Jewson \email{stephen.jewson@gmail.com}
}
