View source: R/csu_ageSpecific.r
| csu_ageSpecific | R Documentation | 
csu_ageSpecific calculate and plot Age-Specific Rate.
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") 
df_data | 
 Data (need to be R   | |||||||||||||||||||
var_age | 
 Age variable. Several format are accepted 
 Missing age value must be precise in the option   | |||||||||||||||||||
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 ...).  | |||||||||||||||||||
missing_age | 
 Age value representing the missing age cases.  | |||||||||||||||||||
db_rate | 
 The denominator population. Default is 100000.  | |||||||||||||||||||
logscale | 
 Logical value: if   | |||||||||||||||||||
plot_title | 
 Title of the plot.  | |||||||||||||||||||
legend | 
 Legend option: see   | |||||||||||||||||||
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 CI5XII for a specific cancer.  | |||||||||||||||||||
var_rate | 
 Name of the age specific variable if a dataframe is return.  | 
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 CI5XII 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.
Return a plot and a data.frame.
Mathieu Laversanne
csu_group_cases
csu_merge_cases_pop
csu_asr
csu_cumrisk
csu_eapc
csu_ageSpecific_top
csu_bar_top
csu_time_trend
csu_trendCohortPeriod
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 CI5XII 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 CI5XII 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(paste0(tempdir(),"/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()
	
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.