As of now 8 small packages have been posted to this site: LexisUtils (see github readme)
LexisSurface < in limbo, have found better ways to do this HMDget (deprecated See HMDHFDplus instead) DecompHoriuchi Lotka Pyramid LifeTable RateSketch EZLex These can be downloaded manually from the downloads page and loaded from local .zip files from the R console, or you can visit the github page and get the package guts there directly. These are roughandready solutions to different graphical and basic demographyrelated things that I repeatedly need access to. They are by no means extensively tested, and version numbers should be considered prerelease. There are also other functions in existence that do some of the things that my functions do. I have no immediate plans of uploading things to CRAN, mostly because I'm still too novice rather than clutter CRAN with a bunch of dinky packages, I'm sort of waiting to accumulate many more functions and just upload one clean package to CRAN... some day, maybe. Until then, in good faith, most of what I do eventually makes it up to this site either in the packages or in individual blog posts. I totally encourage folks to write me reporting bugs and giving suggestions/requests. Awesome bugreporters will be honored in the package documentation. By extension, feel free to contact me here or in github if you'd like to make suggestions, collaborate, fork off or improve on any of this work. The html help files for all the packages are also available on this website, although I might fall behind updating them when packages undergo revisions. Images produced by function examples are also embedded on this site, but not necessarily console output. Package summaries (links lead to index page): LexisUtils NEW built for Shiro Horiuchi to use in class, but also available for everyone. The main function here is LexisMap(), which plots Lexis surfaces for data in AP squares (or AC or PC, with the appropriate orientation). That function uses lattice under the hood and its only advantage are some decent defaults for easy plotting of demographic surfaces. Won't do negative values though! There are also several Lexis matrix functions, AC2PC() etc etc, for convenience.
LexisSurface [NO LONGER MAINTAINED. I posted how to do this in Lattice and in ggplot2]. To make one easily in base graphics, follow the data prep steps outlined in the lattice post] is a package containing a function to plot demographic surfaces consisting in Lexis triangles. There are also 4 different functions available for splitting mortality Mx data from Lexis squares into Lexis triangles for purposes of plotting. These methods are untested; some will be improved, others dropped in the future. Will plot using any color ramp. Flexible legend sizing and positioning. The function plots both logged and notlogged data well. Includes example fertility and mortality data and several plotting examples. [still working on getting good legend labels they are accurate but may overlap at times]. Also see the LexisMap() function in the LexisUtils package for square data. HMDget is a function for reading Human Mortality Database data into R in different formats. You can merge countries and years, and output is available in a few different predefined formats. Database access either local or via the web (based on Carlo Boe's HMD2R function). Super awesome thanks to Felix Rößger and Adrien Remund for reporting bugs! Alas, the function got too out of hand to maintain, and I'll no longer be maintaining it. Look instead to the HMD grabber and reader functions found in the HMDHFDplus package on CRAN. DecompHoriuchi offers the function DecompContinuous(), a generic decomposition program for a wide variety of functions, and no limits to the number of covariates they may have. Also includes an exact R copy of the Matlab function proposed by the authors, called here DecompContinuousOrig(), which takes arguments as a single long vector and is therefore a bit ore flexible. Lotka, a small set of formal demography functions, including estimates of r (3 strategies), calculations of R0, T (mean generation time), agesurvivalfertility decompositions of differences in r and R0, and a Kitagawaish decomposition of differences in R0. Examples are included, which use a dataset from Spain 1975 and 1998. See examples in help files. (added 7 March, 2011) Several changes coming eventually. RateSketch() is for handsketching demographic (or any) agespecific rate patterns. Just define the x and y limits and click the function from left to right. The function returns a list with the points you clicked, plus values interpolated to your desired xvalues (argument = xnew) using loess, spline and linear methods. See examples. I've used this tons for generating fake data to practice other demographic functions on. Documentation to be improved might need to do a video tutorial since it's handson... LexisDiagram is a package with two functions for drawing Lexis diagrams (think presentations and teaching materials). Includes Lexis() and Thighlight(). Try the examples, they're easy. LifeTable Contains a main function LT(), which does the whole basic lifetable spiel, taking either Nx and Dx or else Mx as it's basic arguments. This package also contains example data for Ukraine males, 1965, coming from the HMD, as well as 4 different a(x) estimation methods ("keyfitz", "schoen", "preston" and "midpoint"), all of which were modified by me in some minor way (apologies to the namesakes). See the documentation and examples for further details. It accepts data up to any age, in singleages or fiveyear abridged data. Also optional smoothing (using Giancarlo's MortalitySmooth package). Returns all sorts of demographic agefunctions and a few different measures. I'm thinking of including summary and plot methods in the next release version (no hurry though). This package is now hosted entirely on github, here: http://timriffe.github.io/LifeTable/ . There are installation instructions there, online help files, and that's a good place to report bugs, or make suggestions too. Pyramid provides a simple wrapper with several defaults to
quickly plot a population pyramid, and with simple detection and
plotting of multistate pyramids. The function also gives optional
absolute or percent scales, with flexible agegroup widths, and optional
generation labels on the right axis. This package is now hosted entirely on github, here: http://timriffe.github.io/Pyramid/ . There are installation instructions there, online help files, and that's a good place to report bugs, or make suggestions too. Recently added functions include a pyramid outline function, and a function for aggregating agegroups.
Random scripts: Lotka1922 is not a package it's the code used to replicate my blog entry from Jan 24th, 2011. This code refers to Lotka (1922) The Stability of the Normal Age Distribution PNAS (8) I also try to be helpful with R questions on Stack Exchange: And have a moderately sized but rapidly growing number of R code snippets (called Gists) on github.com:
