Skip to content

Commit

Permalink
add rhub
Browse files Browse the repository at this point in the history
  • Loading branch information
laversannem committed Sep 18, 2024
1 parent 6bc8b49 commit e992e3f
Show file tree
Hide file tree
Showing 8 changed files with 1,306 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
^README\.Rmd$
^NEWS\.Rmd$
^README-.*\.png$
^dev$
^release$
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
69 changes: 69 additions & 0 deletions dev/ICD_CI5XI.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
ICD,LABEL
C00,Lip
C01-02,Tongue
C03-06,Mouth
C07-08,Salivary glands
C09,Tonsil
C10,Other oropharynx
C11,Nasopharynx
C12-13,Hypopharynx
C14,Pharynx unspecified
C15,Oesophagus
C16,Stomach
C17,Small intestine
C18,Colon
C19-20,Rectum
C21,Anus
C22,Liver
C23-24,Gallbladder etc.
C25,Pancreas
C30-31,"Nose, sinuses etc."
C32,Larynx
C33-34,Lung (incl. trachea and bronchus)
C37-38,Other thoracic organs
C40-41,Bone
C43,Melanoma of skin
C44,Other skin
C45,Mesothelioma
C46,Kaposi sarcoma
"C47,C49",Connective and soft tissue
C50,Breast
C51,Vulva
C52,Vagina
C53,Cervix uteri
C54,Corpus uteri
C55,Uterus unspecified
C56,Ovary
C57,Other female genital organs
C58,Placenta
C60,Penis
C61,Prostate
C62,Testis
C63,Other male genital organs
C64,Kidney
C65,Renal pelvis
C66,Ureter
C67,Bladder
C68,Other urinary organs
C69,Eye
C70-72,"Brain, nervous system"
C73,Thyroid
C74,Adrenal gland
C75,Other endocrine
C81,Hodgkin disease
"C82-86,C96",Non-Hodgkin lymphoma
C88,Immunoproliferative diseases
C90,Multiple myeloma
C91,Lymphoid leukaemia
C92-94,Myeloid leukaemia
C95,Leukaemia unspecified
C26-29,Other
C35-36,Other
C39,Other
C42,Other
C48,Other
C59,Other
C76-80,Other
C87,Other
C89,Other
C97-99,Other
43 changes: 43 additions & 0 deletions dev/ICD_globocan.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ICD,LABEL
C00-08,"Lip, oral cavity"
C11,Nasopharynx
"C09-10,C12-14",Other pharynx
C15,Oesophagus
C16,Stomach
C18-21,Colorectum
C22,Liver
C23-24,Gallbladder
C25,Pancreas
C32,Larynx
C33-34,Lung
C43,Melanoma of skin
C44,Other skin
C45,Mesothelioma
C46,Kaposi sarcoma
C50,Breast
C51,Vulva
C52,Vagina
C53,Cervix uteri
C54,Corpus uteri
C56,Ovary
C61,Prostate
C62,Testis
C64-66,Kidney
C67,Bladder
C70-72,"Brain, nervous system"
C73,Thyroid
C81,Hodgkin disease
"C82-86,C96",Non-Hodgkin lymphoma
"C88,C90",Multiple myeloma
C91-95,Leukaemia
C17,Other
C26-31,Other
C35-42,Other
C47-49,Other
C55,Other
C57-60,Other
C63,Other
C68-69,Other
C74-80,Other
C87,Other
C89,Other
135 changes: 135 additions & 0 deletions dev/Rcan_example.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
library(Rcan)

data(csu_registry_data_2)


# ASR with standard error with missing age.
df_asr <- csu_asr(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_age_group = c("registry_label"),
var_st_err = "st_err")

df_asr[1:4,]

# Truncated ASR, 25-69 years.
result <- csu_asr(csu_registry_data_2,
"age", "cases", "py",
group_by = c("registry", "registry_label", "sex", "year", "ethnic" ),
var_age_group = c("registry_label"),
var_st_err = "st_err",
first_age = 6,
last_age = 14,
missing_age = 99)

result[1:4,]


# EAPC with standard error
df_eapc <- csu_eapc(df_asr,
"asr", "year",
group_by=c("registry", "registry_label", "sex", "ethnic" ))

df_eapc[1:4,]



data(csu_registry_data_1)
# plot age specific rate for 1 population.
df_colombia <- csu_registry_data_1[csu_registry_data_1$registry_label=="Colombia, Cali",]

csu_ageSpecific(df_colombia,
plot_title = "Colombia, Liver, male")

# plot age specific rate for 1 population, and comparison with CI5XI data.
csu_ageSpecific(df_colombia,
plot_title = "Colombia, Liver, male",
CI5_comparison = "Liver")

# plot age specific rate for 4 population, legend at the bottom and comparison with CI5XI data.
csu_ageSpecific(csu_registry_data_1,
group_by="registry_label",
logscale = TRUE,
legend=csu_trend_legend(position="right", right_space_margin = 6.5),
plot_title = "Liver, male")


# age specific top 5
data("csu_CI5X_data")

#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,]
#select USAm NPCR
df_data_2 <- df_data[df_data$registry_code== 84080,]


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


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


#cohort period graph
data(csu_registry_data_2)

# to select only 1 population
test <- csu_registry_data_2[csu_registry_data_2$registry == 84020,]
test <- test[test$sex==1,]

# plot cohort graph from 25-29 years until 75-79 years.
csu_trendCohortPeriod(df_data=test,
missing_age =99,
plot_title = "USA, Liver, males")

# plot Period graph from 0-5 until 85+.
csu_trendCohortPeriod(df_data=test,
missing_age =99,
plot_title = "USA, Liver, males",
type="Period",
first_age=1,
last_age=18)

# plot Cohort-Period graph from 30-64 years until 70-74 years.
csu_trendCohortPeriod(df_data=test,
missing_age =99,
plot_title = "USA, Liver, males",
type="Both",
first_age=7,
last_age=15)

# plot Cohort-Period graph from 30-64 years until 70-74 years with Y axis normal scale.
csu_trendCohortPeriod(df_data=test,
missing_age =99,
plot_title = "USA, Liver, males",
type="Both",
first_age=7,
last_age=15,
logscale=FALSE)

# plot Cohort graph from 25-29 years until 75-79 years, with data grouped in 2 years period.
csu_trendCohortPeriod(df_data=test,
missing_age =99,
plot_title = "USA, Liver, males",
type="Cohort",
year_group = 2)
Loading

0 comments on commit e992e3f

Please sign in to comment.