Package LexisPlotR. R topics documented: April 4, 2016. Type Package



Similar documents
Package retrosheet. April 13, 2015

Package sendmailr. February 20, 2015

Package searchconsoler

Package ggrepel. February 8, 2016

Package OECD. R topics documented: January 17, Type Package Title Search and Extract Data from the OECD Version 0.2.

Package uptimerobot. October 22, 2015

Package DCG. R topics documented: June 8, Type Package

Package decompr. August 17, 2016

Package hazus. February 20, 2015

Package tagcloud. R topics documented: July 3, 2015

Package optirum. December 31, 2015

Package erp.easy. September 26, 2015

Package urltools. October 11, 2015

Package syuzhet. February 22, 2015

Package pdfetch. R topics documented: July 19, 2015

Package TSfame. February 15, 2013

Package sjdbc. R topics documented: February 20, 2015

Package empiricalfdr.deseq2

Package plan. R topics documented: February 20, 2015

Package bizdays. March 13, 2015

Package jrvfinance. R topics documented: October 6, 2015

Package DiallelAnalysisR

Package MBA. February 19, Index 7. Canopy LIDAR data

Package png. February 20, 2015

Package SHELF. February 5, 2016

Package wordnet. January 6, 2016

Package neuralnet. February 20, 2015

Package R4CDISC. September 5, 2015

Package RIGHT. March 30, 2015

Package whoapi. R topics documented: June 26, Type Package Title A 'Whoapi' API Client Version Date Author Oliver Keyes

Package dggridr. August 29, 2016

Package ChannelAttribution

Package httprequest. R topics documented: February 20, 2015

Package EasyHTMLReport

Package lmertest. July 16, 2015

Package HHG. July 14, 2015

Package AzureML. August 15, 2015

Package RedditExtractoR

Package hoarder. June 30, 2015

Package dunn.test. January 6, 2016

Package date. R topics documented: February 19, Version Title Functions for handling dates. Description Functions for handling dates.

Package treemap. February 15, 2013

Package mcmcse. March 25, 2016

Package fimport. February 19, 2015

Package pinnacle.api

Package changepoint. R topics documented: November 9, Type Package Title Methods for Changepoint Detection Version 2.

Package TRADER. February 10, 2016

Package bigdata. R topics documented: February 19, 2015

Package treemap. October 14, 2015

Package globe. August 29, 2016

Package MDM. February 19, 2015

Package EstCRM. July 13, 2015

Package bigrf. February 19, 2015

Package differ. R topics documented: February 19, Type Package

Package CRM. R topics documented: February 19, 2015

Package benford.analysis

Package tablaxlsx. R topics documented: June 9, 2016

R Graphics Cookbook. Chang O'REILLY. Winston. Tokyo. Beijing Cambridge. Farnham Koln Sebastopol

Package MixGHD. June 26, 2015

Package CoImp. February 19, 2015

Package dsstatsclient

Package DSsim. September 25, 2015

Excel 2007 Tutorials - Video File Attributes

Package survpresmooth

Package dsmodellingclient

Package DDIwR. R topics documented: February 19, Version Date Title DDI with R Depends R (>= 3.1.0) Imports XML, foreign

Package PRISMA. February 15, 2013

Package brewdata. R topics documented: February 19, Type Package

Package missforest. February 20, 2015

Package GSA. R topics documented: February 19, 2015

STATGRAPHICS Online. Statistical Analysis and Data Visualization System. Revised 6/21/2012. Copyright 2012 by StatPoint Technologies, Inc.

Package pxr. February 20, 2015

Package packrat. R topics documented: March 28, Type Package

Optimization of sampling strata with the SamplingStrata package

Package translater. R topics documented: February 20, Type Package

Package metafuse. November 7, 2015

Each function call carries out a single task associated with drawing the graph.

Package RCassandra. R topics documented: February 19, Version Title R/Cassandra interface

Portal Connector Fields and Widgets Technical Documentation

Package tvm. R topics documented: August 21, Type Package Title Time Value of Money Functions Version Author Juan Manuel Truppia

Package tikzdevice. February 20, 2015

Package MFDA. R topics documented: July 2, Version Date Title Model Based Functional Data Analysis

Package robfilter. R topics documented: February 20, Version 4.1 Date Title Robust Time Series Filters

5 Correlation and Data Exploration

Package AMORE. February 19, 2015

Package cgdsr. August 27, 2015

Package cpm. July 28, 2015

Package hier.part. February 20, Index 11. Goodness of Fit Measures for a Regression Hierarchy

Package wordcloud. R topics documented: February 20, 2015

OVERVIEW OF R SOFTWARE AND PRACTICAL EXERCISE

Package saccades. March 18, 2015

Getting started with qplot

Using R for Windows and Macintosh

Transcription:

Type Package Package LexisPlotR April 4, 2016 Title Plot Lexis Diagrams for Demographic Purposes Version 0.3 Date 2016-04-04 Author [aut, cre], Marieke Smilde-Becker [ctb] Maintainer <philipp@ottolinger.de> Functions to plot Lexis Diagrams for Demographic purposes. Depends R (>= 3.0.0), ggplot2 (>= 1.0.1) Suggests knitr VignetteBuilder knitr LazyData true License GPL-2 URL https://github.com/ottlngr/lexisplotr RoxygenNote 5.0.1 NeedsCompilation no Repository CRAN Date/Publication 2016-04-04 23:56:50 R topics documented: how.old........................................... 2 lexis.age........................................... 2 lexis.cohort......................................... 3 lexis.grid.......................................... 4 lexis.hmd.......................................... 5 lexis.lifeline......................................... 6 lexis.year.......................................... 7 lifelines_sample....................................... 8 prepare.hmd......................................... 8 what.date.......................................... 9 Index 10 1

2 lexis.age how.old Determine numeric age Determines the numeric age in years from a date range. how.old(from, to) from to character, beginning of the date range in YYYY-MM-DD format. character, end of the date range in YYYY-MM-DD format. Helper for LexisPlotR. The numeric age gets rounded to 5 digits. Numeric age in years. how.old(from = "1900-01-01", to = "1905-01-01") lexis.age Emphasize a certain age in Lexis grid Add a coloured rectangle to an existing Lexis grid to highlight a certain age in that Lexis grid. lexis.age(lg, age, fill = "yellow", alpha = 0.5)

lexis.cohort 3 lg, age fill an existing object originally created with lexis.grid(). numeric, set the age to highlight. character, set colour to fill the rectangle. Default is "yellow". alpha numeric, set alpha, the level of transparency for fill. Default is 0.5. Takes an existing Lexis grid and adds a coloured rectangle that highlights all triangles belonging to a certain age. A ggplot2 object. lexis <- lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5) lexis <- lexis.age(lg = lexis, age = 3) lexis.cohort Emphasize a certain cohort in a Lexis grid Takes an existing Lexis grid and adds a coloured rectangle to highlight a certain cohort. lexis.cohort(lg, cohort, fill = "green", alpha = 0.5) lg, cohort fill an existing object originally created with lexis.grid(). numeric, set the cohort to highlight. character, set the colour of the rectangle. Default is "green". alpha numeric, set the level of transparency of the rectangle. Default is 0.5. Takes an existing Lexis grid and adds a coloured rectangle to the plot. The rectangle will highlight a certain cohort in the Lexis grid.

4 lexis.grid lg <- lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5) lexis.cohort(lg = lg, cohort = 1901) lexis.grid Plot a Lexis grid lexis.grid() plots the basic Lexis grid. lexis.grid(year.start, year.end, age.start, age.end) year.start year.end age.start age.end integer, set the year the Lexis Diagram starts with. integer, set the year the Lexis Diagram ends with. integer, set the age the Lexis Diagram starts with. integer, set the age the Lexis Diagram ends with. The function determines the aspect ratio of the x- and y-axis to enforce isosceles triangles. The aspect ratio will not be effected by defining width and height in pdf() or other graphic devices. Because the returned object is a ggplot2 graph, the overall appearence of the graph can be edited by adding themes() to the plot. The functions returns a ggplot2-plot. lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5)

lexis.hmd 5 lexis.hmd Fill Lexis triangles by HMD data The function opens an existing Lexis grid and fill the triangles according to data from the Human Mortality Database. lexis.hmd(lg, hmd.data, column) lg, hmd.data, column an existing object originally created with lexis.grid(). a data.frame created with prepare.hmd(). character, the name of the column of hmd.data the triangles shall be filled with. The function creates a subset of hmd.data that fits in the dimensions of the existing Lexis grid. The triangles will be filled according to the data in column. lg <- lexis.grid(year.start = 1980, year.end = 1985, age.start = 0, age.end = 5) # Load sample data path <- system.file("extdata", "Deaths_lexis_sample.txt", package = "LexisPlotR") deaths.triangles <- prepare.hmd(path) lexis.hmd(lg = lg, hmd.data = deaths.triangles, column = "Total") ### Plot data not explicitly present in HMD data deaths.triangles$ratiomale <- deaths.triangles$male / deaths.triangles$total lexis.hmd(lg, deaths.triangles, "RatioMale")

6 lexis.lifeline lexis.lifeline Plot lifelines into a Lexis grid Add lifelines to an existing Lexis grid. lexis.lifeline(lg, entry, exit = NA, lineends = F, colour = "red", alpha = 1, lwd = 0.5) lg, entry exit lineends colour alpha an existing object originally created with lexis.grid(). character, set the entry or birth date of an individual in format "YYYY-MM-DD". character, set the exit or death date of an individual in format "YYYY-MM-DD". Default is NA (no exit or death observed). logical, if TRUE lineends will be marked. Default is FALSE. character, set the colour of the lifelines. Default is "red". numeric, set the transparency of the lifelines. Default is 1 (no transparency). lwd numeric, set the linewidth of the lifelines. Default is 0.5. Takes an existing Lexis grid and adds lifelines to the grid. Input can be a single dates or dates from a vector. A ggplot2 object. lg <- lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5) lexis.lifeline(lg = lg, entry = "1901-09-23") lexis.lifeline(lg = lg, entry = "1901-09-23", exit = "1904-03-03")

lexis.year 7 lexis.year Emphasize a certain year in Lexis grid. Takes an existing Lexis grid and adds a coloured rectangle to highlight a certain age. lexis.year(lg, year, fill = "blue", alpha = 0.5) lg, year fill an existing object originally created with lexis.grid(). numeric, set the year to highlight. character, set the colour of the rectangle. Default is "blue". alpha numeric, set the transparency of the rectangle. Default is 0.5. Takes an existing Lexis grid and adds a coloured rectangle to the plot. The rectangle will highlight a certain year in the grid. A ggplot2 object. Philipp Ottoliner lg <- lexis.grid(year.start = 1900, year.end = 1905, age.start = 0, age.end = 5) lexis.year(lg = lg, year = 1902)

8 prepare.hmd lifelines_sample Data for 300 random lifelines This dataset contains 300 random entry dates and 150 exit dates for demonstration purposes. lifelines_sample Format A data frame with 300 rows and 2 variables: entry entry or birth dates. exit exit or death dates, NA if not observed. prepare.hmd Prepare HMD data for lexis.hmd() prepare.hmd() prepares the raw Deaths by Lexis triangles HMD data for further use by lexis.hmd. prepare.hmd(file) file, the name of the Deaths by Lexis triangles file downloaded from the Human Mortality Database. This function reads the raw data into R and transforms data to numeric and Date. Furthermore seven columns (upper, x1, x2, x3, y1, y2, y3) that contain the coordinates of the triangles will be added. The age group 110+ will be removed from the data.

what.date 9 # Load sample data path <- system.file("extdata", "Deaths_lexis_sample.txt", package = "LexisPlotR") deaths.triangles <- prepare.hmd(path) what.date Determine the date a certain age is reached Determines the date a certain age is reached given an earlier date. what.date(date, age) date age character, set the reference date in YYYY-MM-DD format. numeric, set an age to be reached. Helper for LexisPlotR. The date age is reached when counting from date. what.date(date = "1900-01-01", age = 3)

Index Topic datasets lifelines_sample, 8 how.old, 2 lexis.age, 2 lexis.cohort, 3 lexis.grid, 4 lexis.hmd, 5 lexis.lifeline, 6 lexis.year, 7 lifelines_sample, 8 prepare.hmd, 8 what.date, 9 10