csu_ageSpecific_top {Rcan} | R Documentation |
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="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 | |||||||||||||||||||
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. | |||||||||||||||||||
var_top |
Cancer label variable or country/registry variable for example. | |||||||||||||||||||
group_by |
Variable to compare different age specific rate (sex, registry ...). | |||||||||||||||||||
missing_age |
Age value representing the missing age cases. | |||||||||||||||||||
db_rate |
The denominator population. Default is 100000. | |||||||||||||||||||
logscale |
Logical value: if | |||||||||||||||||||
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. |
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
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
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
)