Learn R Programming

timelineS (version 0.1.1)

durPlot: Graphs and Summary for Date Durations

Description

Plots boxplot, histogram, density plot, scatter plot, line plot and prints summary statistics for date duration data.

Usage

durPlot(df, start, end, group = NA, timeunit = "days", plot_type = "all", facet = FALSE, facet.nrow = NULL, theme = NULL, other = NULL, fill_color = "black", line_color = "black", groupcolor = TRUE, point_size = 2, alpha = NA, binwidth = 0.5, show_legend = TRUE, title=FALSE, title_boxplot = "Boxplot", title_histogram = "Histogram", title_density = "Density Plot", title_scatter = "Scatter Plot", title_line = "Line Plot")

Arguments

df
Data frame containing start dates, end dates and groups.
start
Column in df for start dates.
end
Column in df for end dates.
group
Column in df for groups. Default is NA.
timeunit
Unit of time to be used in plots. "day(s)", "week(s)", "month(s)", "quarter(s)", "semiannual", "halfyear",or "year(s)".
plot_type
One of "all", "boxplot", "histogram", "density", "scatter", "line". Default is "all".
facet
If TRUE, wraps plots in group facets
facet.nrow
Number of rows for facet wrap
theme
Add theme elements if needed.
other
Add other elements if needed.
fill_color
Fill color
line_color
Line color
groupcolor
If FALSE, fill_color and line_color used for all groups. Default is TRUE.
point_size
Point size for scatterplot
alpha
Color transparency [0,1]
binwidth
Binwidth for histogram; default 0.5.
show_legend
Default is TRUE
title
If TRUE, puts main titles for each plot
title_boxplot
Title for boxplot title
title_histogram
Title for histogram
title_density
Title for density plot
title_scatter
Title for scatter plot
title_line
Title for line plot

Details

The function also returns summary statistics for the specified date duration.

See Also

timelineS, timelineG, durSummary, durCalc

Examples

Run this code
durPlot(life_exp, start = "Birth", end = "Death", group = "Country",
timeunit = "years", facet = TRUE, binwidth = 3, alpha = 0.7, title = TRUE)

durPlot(life_exp, start = "Birth", end = "Death", group = "Country",
timeunit = "years",alpha = 0.5, title = TRUE)

Run the code above in your browser using DataLab