Description Usage Arguments Examples
View source: R/PlotSexRatios.R
asdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | PlotSexRatios(
data,
name.disaggregations,
name.age,
name.sex,
name.males,
name.females,
name.population.year1,
name.population.year2,
name.year1,
name.month1,
name.day1,
name.year2,
name.month2,
name.day2,
name.national = NULL,
label.subnational.level = name.disaggregations,
show.disaggregated.population = TRUE,
ylim.disaggregated = NULL,
ylim.overall = NULL,
line.size.disaggregated = 0.8,
line.size.overall = 0.6,
fig.nrow = 3,
fig.ncol = 2,
save.name.disaggregated = NULL,
save.name.overall = NULL,
plots.dir = ""
)
|
data |
data frame that contains at least seven columns representing: (1) five-year age groups, (2) sex, (3, 4) population counts collected at two different time points (typically adjacent Census years) (5, 6) dates of two different time points (7) the level of subnational disaggregation in additino to sex (e.g. a geographic unit such as a province/state, a sociodemographic category such as education level, or combinations thereof). |
name.disaggregations |
Character string providing the name of the variable in 'data' that represents the levels of subnational disaggregation |
name.age |
Character string providing the name of the variable in 'data' that represents age |
name.sex |
Character string providing the name of the variable in 'data' that represents sex |
name.males |
Character string providing the name of the value of 'name.sex' variable that represents males |
name.females |
Character string providing the name of the value of 'name.sex' variable that represents females |
name.population.year1 |
Character string providing the name of the variable in 'data' that represents the population count in the earlier time period |
name.population.year2 |
Character string providing the name of the variable in 'data' that represents the population count in the later time period |
name.year1 |
Character string providing the name of the variable in 'data' that represents the year of the earlier of the two time periods (e.g. year of the earlier Census) |
name.month1 |
Character string providing the name of the variable in 'data' that represents the month of the earlier of the two time periods (e.g. month of the earlier Census) |
name.day1 |
Character string providing the name of the variable in 'data' that represents the day of the earlier of the two time periods (e.g. day of the earlier Census) |
name.year2 |
Character string providing the name of the variable in 'data' that represents the year of the later of the two time periods (e.g. year of the later Census) |
name.month2 |
Character string providing the name of the variable in 'data' that represents the month of the later of the two time periods (e.g. month of the later Census) |
name.day2 |
Character string providing the name of the variable in 'data' that represents the day of the later of the two time periods (e.g. day of the later Census) |
name.national |
A character string providing the value of 'name.disaggregations' variable that indicates national-level results (e.g. "Overall" or "National"). Defaults to NULL, implying 'name.disaggregations' variable in 'data' only includes values for subnational levels. Defaults to NULL |
label.subnational.level |
A character label for the legend showing level of subnational disaggregation present in the data. Defaults to 'name.disaggregations' |
show.disaggregated.population |
A logical indicated whether the population in date2 should be displayed on the disaggreagted plots (in the title of the plot). Defaults to TRUE |
ylim.disaggregated |
A vector with two numeric entries indicating the minimum and maximum values of the y-axis for the sex ratios plotted on a separate graph within each level of disaggregation. Default to NULL, which uses the smallest and largest sex ratios within each level |
ylim.overall |
A vector with two numeric entries indicating the minimum and maximum values of the y-axis for the overall sex ratio where all levels of disaggregation are plotted on the same graph. Defaults to NULL,which uses the smallest and largest sex ratios in the entire dataset |
line.size.disaggregated |
Numeric fed into ggplot2::geom_line(size)) for the disaggregated plots (i.e. sex ratio plotted separately within each level). Defaults to 0.8 |
line.size.overall |
Numeric fed into ggplot2::geom_line(size)) for the overall plot (i.e. sex ratios from all levels plotted on the same graph). Defaults to 0.6 |
save.name.disaggregated |
A character specifying a custom file name for the disaggregated plots saved on the local file system. Defaults to NULL, which combines 'name.disaggregations' and the current date |
save.name.overall |
A character specifying a custom file name for the overall plots saved on the local file system. Defaults to NULL, which combines 'name.disaggregations' and the current date |
plots.dir |
A character specifying the directory where plots should be saved. Defaults to "", saving the plots in the working directory |
fig.nrow.disaggregated |
An integer fed to 'gridExtra::arrangeGrob(nrow)' to indicate how many rows should be used on each page to display the disaggregated plots. Defaults to 3 |
fig.ncol.disaggregated |
An integer fed to 'gridExtra::arrangeGrob(ncol)' to indicate how many columns should be used on each page to display the disaggregated plots. Defaults to 2 |
fig.nrow.overall |
An integer fed to 'gridExtra::arrangeGrob(nrow)' to indicate how many rows should be used on each page to display the overall plot. Defaults to 2 |
fig.ncol.overall |
An integer fed to 'gridExtra::arrangeGrob(ncol)' to indicate how many columns should be used on each page to display the overall plot. Defaults to 1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ecuador_plot_sex_ratios <- PlotSexRatios(data=ecuador_single_year_ages_combined,
name.disaggregations="province_name",
name.males="m",
name.females="f",
name.age="age",
name.sex="sex",
name.date1="date1",
name.date2="date2",
name.population.year1="pop1",
name.population.year2="pop2",
name.national="National",
label.subnational.level="Province")
head(ecuador_plot_sex_ratios)
tail(ecuador_plot_sex_ratios)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.