Learn R Programming

Rcan (version 1.3.70)

csu_ageSpecific: csu_ageSpecific

Description

csu_ageSpecific calculate and plot Age-Specific Rate.

Usage

csu_ageSpecific(df_data,
		var_age="age",
        var_cases="cases",
        var_py="py",
        group_by = NULL, 
        missing_age = NULL,
        db_rate = 100000,
		logscale=FALSE,
        plot_title=NULL,
        legend=csu_trend_legend(),
        color_trend = NULL,
        CI5_comparison=NULL,
        var_rate="rate")

Arguments

df_data

Data (need to be R data.frame format, see example to import csv file).

var_age

Age group variable: (numerical) 18 5-years age-group, 0-4, 5-9, .. 85+ and an optional missing age. The value can be 1,2..19, as well as 0,5,..85 or other value as long are they are numerical.

var_cases

Number of event (cases, deaths, ...) variable.

var_py

Population year variable.

group_by

Variable to compare different age specific rate (sex, country, cancer ...). Only one variable can be chosen.

missing_age

Age value representing the missing age cases.

db_rate

The denominator population. Default is 100000.

logscale

Logical value: if TRUE Y-axis use logscale.

plot_title

Title of the plot.

legend

Legend option: see csu_trend_legend. Use only if group_by is not NULL.

color_trend

Vector of color for the trend. The color code are hexadecimal (see example).

CI5_comparison

Add a dotted line representing the CI5X for a specific cancer. Value can be a cancer_label (example: "Liver"), or a cancer_code (example = 7). See csu_ci5x_mean to get the list of possible values.

var_rate

Name of the age specific variable if a dataframe is return.

Value

Return a plot and a data.frame.

Details

This function calculate and plot the age specific rate. The group_by option allow to compare different population or cancer. The CI5_comparison option allow to compare with the CI5X and therefore test the quality of the data. If the population data stops before 85+ (75+ for instance), the population data must be 0 when the population data is unknown so, the program can detect automatically the last age group (70+,75+,80+ or 85+) for population.

References

https://publications.iarc.fr/_publications/media/download/3753/609d0d7711047dd76d7f3dbaa25d7f041fcd013e.pdf

See Also

csu_group_cases csu_merge_cases_pop csu_asr csu_eapc csu_ageSpecific_top csu_bar_top csu_time_trend csu_trendCohortPeriod

Examples

Run this code
# NOT RUN {
data(csu_registry_data_1)
data(csu_registry_data_2)

# you can import your data from csv file using read.csv:
# mydata <-  read.csv("mydata.csv", sep=",")

# to select only 1 population.
test <- csu_registry_data_1[csu_registry_data_1$registry_label=="Colombia, Cali",]

# plot age specific rate for 1 population.
csu_ageSpecific(test,
				plot_title = "Colombia, Liver, male")

# plot age specific rate for 1 population, and comparison with CI5X data.
csu_ageSpecific(test,
				plot_title = "Colombia, Liver, male",
				CI5_comparison = "Liver")

# plot age specific rate for 4 population, 
# legend at the bottom and comparison with CI5X data.
csu_ageSpecific(
	csu_registry_data_1,
	group_by="registry_label",
	legend=csu_trend_legend(position="bottom", nrow = 1),
	plot_title = "Liver, male",
	CI5_comparison = 7
	)

	
# }
# NOT RUN {
# plot age specific rate for 4 population, legend at the right.
csu_ageSpecific(
	csu_registry_data_1,
	group_by="registry_label",
	legend=csu_trend_legend(
		position="right", right_space_margin = 6.5
	),
	plot_title = "Liver, male")	



# Plot embedded in a graphic device
pdf("test.pdf",width = 11.692 , height =  8.267) 


csu_ageSpecific(
	csu_registry_data_1,
	group_by="registry_label",
	legend=csu_trend_legend(position="bottom", nrow = 2),
	plot_title = "Liver, male",
	CI5_comparison = 7)

plot.new()

csu_ageSpecific(
	csu_registry_data_1,
	group_by="registry_label",
	legend=csu_trend_legend(
		position="right", right_space_margin = 6.5
	),
	plot_title = "Liver, male")	



dev.off()

# }
# NOT RUN {


	
# }

Run the code above in your browser using DataLab