csu_ageSpecific {Rcan}R Documentation

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 variable. Several format are accepted

1 "0-4" 0
2 "5-9" 5
3 "10-14" 10
... ... ...
17 "80-84" 80
18 "85+" 85

Missing age value must be precise in the option missing_age.
Last age group will always be considere without size (ie: 80+,85+, etc..).

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 codes are hexadecimal (e.g. "#FF0000") or predefined R color names (e.g. "red").

CI5_comparison

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

var_rate

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

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 CI5XI 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.

Value

Return a plot and a data.frame.

Author(s)

Mathieu Laversanne

References

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

See Also

csu_group_cases csu_merge_cases_pop csu_asr csu_cumrisk csu_eapc csu_ageSpecific_top csu_bar_top csu_time_trend csu_trendCohortPeriod

Examples


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 <- subset(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 CI5XI 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 CI5XI data using cancer code.
csu_ageSpecific(
	csu_registry_data_1,
	group_by="registry_label",
	legend=csu_trend_legend(position="bottom", nrow = 1),
	plot_title = "Liver, male",
	CI5_comparison = 16
	)

	

# 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 = 16)

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()





	

[Package Rcan version 1.3.82 Index]