Skip to content

Commit

Permalink
minor changes all over to pass checks
Browse files Browse the repository at this point in the history
  • Loading branch information
timriffe committed Jan 3, 2021
1 parent 225867f commit 2cc7b9e
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 48 deletions.
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: DemoTools
Type: Package
Title: Standardize, Evaluate, and Adjust Demographic Data
Version: 01.10.05
Version: 01.11.000
Date: 2021-01-03
Authors@R: c(
person("Tim", "Riffe", role = c("aut", "cre"),
Expand Down Expand Up @@ -31,8 +31,7 @@ Suggests:
knitr,
rmarkdown,
DT,
ggplot2,
bibtex (>= 0.4.2)
ggplot2
RdMacros: Rdpack
Imports:
demogR,
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export(ADM)
export(AGEN)
export(ID)
export(IRD)
export(OPAG)
export(OPAG_fit_stable_standard)
export(OPAG_nLx_warp_r)
export(OPAG_r_min)
Expand Down Expand Up @@ -35,6 +36,7 @@ export(check_heaping_spoorenberg)
export(check_heaping_whipple)
export(dec.date)
export(downloadSRB)
export(downloadnLx)
export(getModelLifeTable)
export(graduate)
export(graduate_beers)
Expand Down Expand Up @@ -132,6 +134,7 @@ import(Rcpp)
import(Rdpack)
import(demogR)
importFrom(MortalityLaws,MortalityLaw)
importFrom(Rdpack,reprompt)
importFrom(demogR,cdmltw)
importFrom(dplyr,group_by)
importFrom(dplyr,mutate)
Expand Down
1 change: 1 addition & 0 deletions R/DemoTools-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @import Rcpp
#' @importFrom MortalityLaws MortalityLaw
#' @importFrom stats coef predict
#' @importFrom Rdpack reprompt
#' @name DemoTools-package
#' @docType package
"_PACKAGE"
Expand Down
13 changes: 8 additions & 5 deletions R/OPAG.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ OPAG_simple <-
#' @param Age interger vector of lower bounds of age groups of `nLx`
#' @param r stable growth rate
#' @param AgeInt optional integer vector of widths of age groups, inferred if not given.
#' @param continous logical. If `TRUE` we use the growth adjustment. `e^(-age*r)`. If `FALSE` we assume `r` is geometric growth, and we use `(1+r)^age` for the growth adjustment.
#' @param continuous logical. If `TRUE` we use the growth adjustment. `e^(-age*r)`. If `FALSE` we assume `r` is geometric growth, and we use `(1+r)^age` for the growth adjustment.
#' @param method character, graduation method used for intermediate graduation. Default `"uniform"`. Other reasonable choices include `"mono"` or `"pclm"`.
#' @return numeric vector of the transformed `nLx`. Note, this vector sums to `1`.
#' @export
Expand Down Expand Up @@ -173,13 +173,13 @@ OPAG_nLx_warp_r <- function(nLx,
#' @param nLx numeric vector of stable population standard
#' @param Age_nLx integer vector of lower bounds for age groups of `nLx`
#' @param AgeInt_nLx optional integer vector of widths of age groups of `nLx`, inferred if not given.
#' @param continous logical. If `TRUE` we use the growth adjustment. `e^(-age*r)`. If `FALSE` we assume `r` is geometric growth, and we use `(1+r)^age` for the growth adjustment.
#' @param continuous logical. If `TRUE` we use the growth adjustment. `e^(-age*r)`. If `FALSE` we assume `r` is geometric growth, and we use `(1+r)^age` for the growth adjustment.
#' @param method character. Graduation method, default `"uniform"`. `"mono"` or `"pclm"` would also be good choices.
#' @return numeric. A residual that you're presumably trying to minimize.
#' @export

#' @examples
#' Make up some population data to fit to:
#' # Make up some population data to fit to:
#' Pop_fit <- c(85000,37000)
#' Age_fit <- c(70,80)
#' AgeInt_fit <- c(10,10)
Expand Down Expand Up @@ -386,8 +386,11 @@ OPAG_fit_stable_standard <- function(Pop_fit,
#' @param Pop numeric vector of population counts
#' @param Age_Pop integer vector of the lower bounds of the population age groups
#' @param AgeInt_Pop integer vector of the population age group interval widths, using `Inf` for the open age group.

#'India Males, 1991
#' @param Redistribute_from integer lower age bound that forms the cutoff, above which we redistribute counts using the stable standard.
#' @param OAnew integer. Desired open age group in the output (must being element of `Age_nLx`)
#' @export
#' @examples
#' # India Males, 1991
#' Pop <- smooth_age_5(pop1m_ind,
#' Age = 0:100,
#' method = "Arriaga")
Expand Down
13 changes: 11 additions & 2 deletions R/basepop.R
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,17 @@ lt_infer_radix_from_1L0 <- function(L0){
the_radix
}

# TR: radix removed, as it seems lx was 1 but nLx was based on 1e5...
# will use indirect inference.
#' Extract Lx estimates from WPP2019
#' @description We use the `FetchLifeTableWpp2019` function of the `fertestr` to extract `Lx` from `wpp2019`, interpolated to an exact date.
#' @param nLx either `NULL` or a numeric vector of lifetable exposure. If it's the second then we just pass it back.
#' @param country character country name available UN Pop Div `LocName` set
#' @param gender `"male"`, `"female"`, or `"both"`
#' @param nLxDatesIn numeric vector of three decimal dates produced by (or passed through) `basepop_ive()`
#'
#' @return numeric matrix of `nLx` with `length(nLxDatesIn)` and abrdiged ages in rows.
#' @export
#'
#' @importFrom rlang .data
downloadnLx <- function(nLx, country, gender, nLxDatesIn) {
requireNamespace("fertestr", quietly = TRUE)
requireNamespace("magrittr", quietly = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![R CMD Check via {tic}](https://github.com/timriffe/DemoTools/workflows/R%20CMD%20Check%20via%20%7Btic%7D/badge.svg)
[![codecov](https://codecov.io/gh/timriffe/DemoTools/branch/master/graph/badge.svg)](https://codecov.io/gh/timriffe/DemoTools)
[![](https://img.shields.io/badge/devel%20version-01.10.05-yellow.svg)](https://github.com/timriffe/DemoTools)
[![](https://img.shields.io/badge/devel%20version-01.11.000-yellow.svg)](https://github.com/timriffe/DemoTools)
[![issues](https://img.shields.io/github/issues-raw/timriffe/DemoTools.svg)](https://github.com/timriffe/DemoTools/issues)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)

Expand Down
72 changes: 40 additions & 32 deletions man/OPAG.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/OPAG_fit_stable_standard.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/OPAG_nLx_warp_r.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/OPAG_r_min.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions man/downloadnLx.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2cc7b9e

Please sign in to comment.