csu_ageSpecific_top: csu_ageSpecific_top

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/csu_ageSpecific_top.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
csu_ageSpecific_top(df_data,
           var_age="age",
       	   var_cases="cases",
           var_py="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 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.

var_top

Cancer label variable or country/registry variable for example.

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 codes are hexadecimal (e.g. "#FF0000") or predefined R color names (e.g. "red").
This allow to keep the same color coding for each graph.

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.

Value

Return plots 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 csu_bar_top csu_time_trend csu_trendCohortPeriod

Examples

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
library(Rcan)
data("csu_CI5XI_data")

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

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

#remove all cancers:
df_data <- subset(csu_CI5XI_data ,cancer_code < 62)
df_data$sex <- factor(df_data$sex, levels=c(1,2), labels=c("Male", "Female"))

#select Thailand changmai
df_data_1 <- subset(df_data, registry_code==764001)


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



	#select USAm NPCR
	df_data_2 <- subset(df_data,registry_code== 840000 & ethnic_group == 99)


	# 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",
			plot_subtitle = "Top 5 cancer",
			missing_age = 19
			)




	

Rcan documentation built on July 1, 2020, 10:20 p.m.