Learn R Programming

Rcan (version 1.3.70)

csu_ageSpecific_top: csu_ageSpecific_top

Description

csu_ageSpecific_top calculate and plot Age-Specific Rate for the top X cancer or top X population.

Usage

csu_ageSpecific_top(df_data,
           var_age, 
           var_cases,
           var_py,
           var_top, 
           group_by=NULL,
           missing_age=NULL,
           db_rate = 100000,
           logscale = FALSE,
           nb_top = 5,
           plot_title=NULL,
           plot_subtitle=NULL,
           var_color=NULL)

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.

var_top

cancer label variable or population variable.

group_by

Variable to compare different age specific rate (sex, registry ...). Only one variable can be chosen. One graph will be produce per variable. If the variable is a factor, the labels associate to the variable will be the subtitle of the plot. See factor.

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.

nb_top

Lowest Rank include. Default is 5.

plot_title

Title of the plot.

plot_subtitle

Subtitle of the plot. (For example, "Top 5 cancer").

var_color

Variable with a color associate to each cancer. The color code are hexadecimal. This allow to keep the same color coding for each graph.

Value

Return plots and a data.frame.

Details

This function keep only the top X cancer and plot their age specific rate. The group_by option allow to compare different population. 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 csu_bar_top csu_time_trend csu_trendCohortPeriod

Examples

Run this code
# NOT RUN {
library(Rcan)
data("csu_CI5X_data")

#get the registry code asssociate to registry_label
print(unique(csu_CI5X_data[,c("registry_label", "registry_code")]),nrows = 1000)

#get the cancer code asssociate to cancer_label
print(unique(csu_CI5X_data[,c("cancer_label", "cancer_code")]),nrows = 1000)

#remove all cancers:
df_data <- csu_CI5X_data[csu_CI5X_data$cancer_code < 62,]

#select Thailand changmai
df_data_1 <- df_data[df_data$registry_code==76401,]

# plot for Thailand Changmai
dt_result_1 <- 
	csu_ageSpecific_top(df_data_1,
		var_age="age", 
		var_cases="cases", 
		var_py="py",
		var_top="cancer_label", 
		group_by="sex", 
		plot_title= "Thailand, Chiangmai",
		plot_subtitle = "Top 5 cancer",
		missing_age = 19)

# }
# NOT RUN {
	#select USAm NPCR
	df_data_2 <- df_data[df_data$registry_code== 84080,]

	# plot for USA NPCR
	dt_result_2 <- 
		csu_ageSpecific_top(
			df_data_2,
			var_age="age", 
			var_cases="cases", 
			var_py="py",
			var_top="cancer_label", 
			group_by="sex", 
			plot_title= "USA, NPCR",
			plot_subtitle = "Top 5 cancer",
			missing_age = 19
			)
# }
# NOT RUN {


	
# }

Run the code above in your browser using DataLab