create_site_morp() counts ICD-10 site codes or morphology groups within
user-defined strata. It can be applied to objects with class canreg,
canregs, fbswicd, or fbswicds.
Usage
create_site_morp(
x,
...,
type = c("icd10", "morp", "both"),
flatten = TRUE,
collapse = TRUE,
wrap_subsite = FALSE,
class_morp = TRUE,
drop_nos = TRUE,
cancer_type = "big"
)
# S3 method for class 'canreg'
create_site_morp(
x,
...,
type = c("icd10", "morp", "both"),
flatten = TRUE,
wrap_subsite = FALSE,
class_morp = TRUE,
drop_nos = TRUE,
cancer_type = "big"
)
# S3 method for class 'canregs'
create_site_morp(
x,
...,
type = c("icd10", "morp", "both"),
flatten = TRUE,
collapse = TRUE,
wrap_subsite = FALSE,
class_morp = TRUE,
drop_nos = TRUE,
cancer_type = "big"
)
# S3 method for class 'fbswicds'
create_site_morp(
x,
...,
type = c("icd10", "morp", "both"),
flatten = TRUE,
collapse = TRUE,
wrap_subsite = FALSE,
class_morp = TRUE,
drop_nos = TRUE
)
# S3 method for class 'fbswicd'
create_site_morp(
x,
...,
type = c("icd10", "morp", "both"),
flatten = TRUE,
wrap_subsite = FALSE,
class_morp = TRUE,
drop_nos = TRUE
)Arguments
- x
An object with class
canreg,canregs,fbswicd, orfbswicds.- ...
Variables used to define strata. For example,
year,sex, andcancerwill return frequencies within each combination of year, sex, and cancer group.- type
Character. Type of frequency table to return when
flatten = TRUE. Options are"icd10","morp", and"both"."icd10"returns ICD-10 site-code frequencies and is the default;"morp"returns morphology-code or morphology-class frequencies;"both"returns both results as a named list with elementsicd10andmorp.- flatten
Logical. If
TRUE, flatten theicd10ormorplist-column frequency tables in a singlefbswicdobject into ordinary data frames with one row per stratum-code combination. IfFALSE, keep the intermediate list-column structure with one row per stratum and two list-columns,icd10andmorp.- collapse
Logical. Only used for
canregsandfbswicds. IfTRUE, merge multiple registry objects before creating site/morphology frequency tables. IfFALSE, return one result per registry object as a list.- wrap_subsite
Logical. If
TRUE, collapse ICD-10 subsite codes into two broad groups: codes ending with.9are coded as"CXX.9"; all other subsite codes are coded as"CXX.0". Counts are then summed within these broad groups.- class_morp
Logical. If
TRUE, classify morphology codes withclassify_morp()before summing counts. IfFALSE, counts are returned by the original morphology code. Whencanceris included in the stratification variables, its value is used as thegroupargument passed toclassify_morp(), currently"60"or"125".- drop_nos
Logical. Reserved for future use. Currently this argument is accepted but not used by the function.
- cancer_type
Character. Cancer classification type passed to
count_canreg()whenxis acanregorcanregsobject.
Value
The return value depends on input class, flatten, collapse, and type:
For a single
fbswicdorcanregobject withflatten = TRUEandtype = "icd10", returns a data frame with the stratification variables,icd10, andcount.With
flatten = TRUEandtype = "morp", returns a data frame with the stratification variables,morp, andcount.With
flatten = TRUEandtype = "both", returns a named list containingicd10andmorpdata frames.With
flatten = FALSE, returns a data frame with the stratification variables,icd10, andmorp, whereicd10andmorpare list-columns of frequency tables.For
canregsorfbswicds,collapse = TRUEreturns a merged result;collapse = FALSEreturns one result per registry object as a list.
Details
For canreg and canregs objects, the function first calls
count_canreg() to create fbswicd/fbswicds objects, and then counts the
icd10 and/or morp frequency tables stored in the sitemorp element.
For fbswicd and fbswicds objects, a sitemorp component must be
present. If it was omitted when constructing the object, the function
reports that site/morphology data are unavailable. An explicitly supplied
zero-row component is treated as available and returns an empty result.
Examples
if (FALSE) { # \dontrun{
data("canregs")
create_site_morp(canregs, year, sex, cancer)
create_site_morp(canregs, year, sex, cancer, type = "morp")
create_site_morp(canregs, year, sex, cancer, type = "both")
create_site_morp(canregs, year, sex, cancer, collapse = FALSE)
fbsw <- count_canreg(canregs[[1]])
create_site_morp(fbsw, year, sex, cancer, flatten = FALSE)
} # }
