% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/415_elt_collapse_regions.R
\name{elt_collapse_regions}
\alias{elt_collapse_regions}
\title{For an ELT with multiple occurrences of each event, collapses to 1 per event}
\usage{
elt_collapse_regions(elt1, columns2copy = NULL, combine = TRUE, verbose = TRUE)
}
\arguments{
\item{elt1}{A data frame containing the ELT.
The ELT must contain \code{evid}.}

\item{columns2copy}{Copies these columns into the output}

\item{combine}{If false, then just copies the first set of values}

\item{verbose}{Logical for verbose or not}
}
\value{
A new ELT with just single occurrence of each event
}
\description{
Takes in an ELT that might have multiple occurrences of each event,
representing different regions, and combines them together to give
one occurrence of that event.
Assumes that the occurrences of each event are consecutive.
Processes other columns cleverly, depending on what they contain.
For instance, adds up losses and exposures, counts regions.
}
\details{
Recognizes and processes the following columns if they exist:
\code{mloss} (sums them up),
\code{sloss} (assumes independent),
\code{expo}	(sums them up),
\code{mrate} (copies the first one).
\code{lfreg} (counts them).
For other specified columns, copies the first value for each event.
How to combine \code{sloss} though? Right now I'm using independence.
But presumably I should use correlation of secondary uncertainty.
}
\examples{
#
# create an elt
#
evid=c(1,2,2,3,3,3,4,4,4,4) #evid is required
#mloss is not required, but is processed intelligently
mloss=rep(1,10)
#jim is not required, but is copied because we specify that
jim=c(1000:1009)
bob=c(2000:2009)
#
elt1=data.frame(evid,mloss,jim,bob)
elt2=elt_collapse_regions(elt1,columns2copy=c("jim"),verbose=TRUE)
#
message("elt1=\n")
print(elt1)
message("elt2=\n")
print(elt2)
}
\author{
Stephen Jewson \email{stephen.jewson@gmail.com}
}
