% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_rosbris.R
\name{get_rosbris}
\alias{get_rosbris}
\title{Download RosBris Data}
\source{
Russian Fertility and Mortality Database. Center for Demographic
Research, Moscow (Russia). Available at
\url{https://www.nes.ru/research-main/research-centers/demogr/demogr-fermort-data}
}
\usage{
get_rosbris(
  dataset = c("mortality_1", "mortality_5", "fertility_1", "fertility_5"),
  refresh = FALSE
)
}
\arguments{
\item{dataset}{Character. Dataset to download and parse. One of
\code{"mortality_1"}, \code{"mortality_5"}, \code{"fertility_1"}, or \code{"fertility_5"}.}

\item{refresh}{Logical. If \code{FALSE} (default), previously downloaded RosBris
archives are reused from the local cache directory. If \code{TRUE}, archives are
downloaded again from the RosBris website.}
}
\value{
A data frame with one row per year-region-age combination. Column
structure depends on \code{dataset}; see \strong{Details}.
}
\description{
Download age-specific mortality, fertility, and population data from the
Russian Fertility and Mortality Database (RosBris) and return them as
long-format data frames for use in \code{demor}.
}
\details{
The function downloads official \code{.zip} archives from the RosBris website,
stores them in a user cache directory created by \code{tools::R_user_dir()}, reads
\code{.txt} tables from the archives, and converts them to long-format data frames.

Returned data have the following structure:
\itemize{
\item \code{"mortality_1"}: \code{year}, \code{code}, \code{territory}, \code{sex}, \code{age}, \code{mx}, \code{N},
\code{Dx}, \code{name}.
\item \code{"mortality_5"}: \code{year}, \code{code}, \code{territory}, \code{sex}, \code{age}, \code{mx}, \code{N},
\code{Dx}, \code{name}.
\item \code{"fertility_1"}: \code{year}, \code{code}, \code{territory}, \code{age}, \code{fx}, \code{N}, \code{Bx},
\code{name}.
\item \code{"fertility_5"}: \code{year}, \code{code}, \code{territory}, \code{age}, \code{fx}, \code{fx1}, \code{fx2},
\code{fx3}, \code{fx4}, \code{fx5}, \code{N}, \code{Bx}, \code{Bx1}, \code{Bx2}, \code{Bx3}, \code{Bx4}, \code{Bx5},
\code{name}.
}

At the moment, \code{get_rosbris()} uses the legacy RosBris series corresponding
to the periods \code{1989-2014} and \code{2015-2022}. Updated post-census series are
not used by this function.
}
\examples{
\donttest{
if (interactive()) {
  mort <- get_rosbris("mortality_5")
  rus2010 <- subset(
    mort,
    year == 2010 & code == 1100 & sex == "m" & territory == "t"
  )
  head(rus2010)
}
}

}
\seealso{
\link{rosbris.codes}
}
