Imports the FCDS data file and applies basic data pre-processing. If the user provides only the path to the raw FCDS data, by default this function will save a cached version of the pre-processed data in fcds default directory (see fcds_default_data_path() for more information). The user can then subsequently call fcds_load() to load the cached, pre-processed data rather than repeating the importing process or needing to locate the original raw data. The data caching can be disabled by setting output_file = NULL.

fcds_import(file, output_dir = fcds_default_data_path(),
  output_file = "fcds_%F-%H%M.rds", ...,
  keep_original_columns = FALSE, fcds_recoding = NULL,
  verbose = TRUE, col_types = readr::cols(.default =
  readr::col_character()))

Arguments

file

The raw FCDS data file

output_dir

The location where the cleaned FCDS data files should be located. Set to NULL save to current working directory. By default, stores the processed data in fcds_default_data_path(), which in general points to the global FCDS data cache.

output_file

Name of the file to store the cleaned FCDS data file. If you don't want to save the cleaned data, set output_file = NULL. The file name is formatted using strftime() and the current system time.

...

Arguments passed on to readr::read_csv

file

Either a path to a file, a connection, or literal data (either a single string or a raw vector).Files ending in .gz, .bz2, .xz, or .zip will be automatically uncompressed. Files starting with http://, https://, ftp://, or ftps:// will be automatically downloaded. Remote gz files can also be automatically downloaded and decompressed.Literal data is most useful for examples and tests. It must contain at least one new line to be recognised as data (instead of a path) or be a vector of greater than length 1.Using a value of clipboard() will read from the system clipboard.

quote

Single character used to quote strings.

col_names

Either TRUE, FALSE or a character vector of column names.If TRUE, the first row of the input will be used as the column names, and will not be included in the data frame. If FALSE, column names will be generated automatically: X1, X2, X3 etc.If col_names is a character vector, the values will be used as the names of the columns, and the first row of the input will be read into the first row of the output data frame.Missing (NA) column names will generate a warning, and be filled in with dummy names X1, X2 etc. Duplicate column names will generate a warning and be made unique with a numeric prefix.

col_types

One of NULL, a cols() specification, or a string. See vignette("readr") for more details.If NULL, all column types will be imputed from the first 1000 rows on the input. This is convenient (and fast), but not robust. If the imputation fails, you'll need to supply the correct types yourself.If a column specification created by cols(), it must contain one column specification for each column. If you only want to read a subset of the columns, use cols_only().Alternatively, you can use a compact string representation where each character represents one column: c = character, i = integer, n = number, d = double, l = logical, f = factor, D = date, T = date time, t = time, ? = guess, or _/- to skip the column.

locale

The locale controls defaults that vary from place to place. The default locale is US-centric (like R), but you can use locale() to create your own locale that controls things like the default time zone, encoding, decimal mark, big mark, and day/month names.

na

Character vector of strings to interpret as missing values. Set this option to character() to indicate no missing values.

quoted_na

Should missing values inside quotes be treated as missing values (the default) or strings.

comment

A string used to identify comments. Any text after the comment characters will be silently ignored.

trim_ws

Should leading and trailing whitespace be trimmed from each field before parsing it?

skip

Number of lines to skip before reading data.

n_max

Maximum number of records to read.

guess_max

Maximum number of records to use for guessing column types.

progress

Display a progress bar? By default it will only display in an interactive session and not while knitting a document. The display is updated every 50,000 values and will only display if estimated reading time is 5 seconds or more. The automatic progress bar can be disabled by setting option readr.show_progress to FALSE.

skip_empty_rows

Should blank rows be ignored altogether? i.e. If this option is TRUE then blank rows will not be represented at all. If it is FALSE then they will be represented by NA values in all the columns.

keep_original_columns

Should the original FCDS columns be kept in the imported data? By default, only the cleaned columns are kept.

fcds_recoding

The FCDS recoding definition. See the FCDS Recoding section for more information. Set to NULL to use the fcds package default settings for the current year's release. See fcds_recoding() for recoding settings for previous years.

verbose

Prints additional information about the importing process

col_types

Passed to readr::read_csv(). By default, all columns are imported initially as character and are recoded or updated during the pre-processing step.

Value

A tibble containing the pre-processed FCDS and optionally the original columns of the raw FCDS data (if keep_original_columns = TRUE). The pre-processing step provides the following columns.

  • patient_id: Patient ID Number. NAACCR Item #20. Derived from Patient_ID_N20.

  • year_group: Year of Diagnosis (5 year group). NAACCR Item #390. Derived from Date_of_Dx_Year_Recoded.

  • year: Year of Diagnosis (midpoint of 5 year group). NAACCR Item #390. Derived from Date_of_Dx_Year_Recoded.

  • cancer_status: Cancer Status at time abstract was completed. NAACCR Item #1770. Derived from Cancer_Status_N1770.

  • cancer_site_group: FCDS Site Group. NAACCR Item #2220. Derived from FCDS_Site_Group.

  • cancer_site_specific: FCDS Site Group with specific within-group areas. NAACCR Item #2220. Derived from FCDS_Site_Group.

  • confirmation: Diagnostic Confirmation at first diagnosis. NAACCR Item #490. Derived from Diagnostic_Confirmation_N490.

  • age_group: FCDS Age Group. NAACCR Item #2220. Derived from FCDS_Age_Group.

  • race: Race (recoded). NAACCR Item #160. Derived from Race_Recoded.

  • sex: Sex (recoded). NAACCR Item #220. Derived from Sex_Recoded.

  • origin: Spanish/Hispanic Origin (recoded). NAACCR Item #190. Derived from Ethnicity_Recoded.

  • marital_status: Marital Status at diagnosis (recoded). NAACCR Item #150. Derived from Marital_Status_Recoded.

  • county_name: County Name of patient's primary residence at the time tumor was diagnosed. NAACCR Item #90. Derived from County_at_DX_N90.

  • county_fips: County FIPS Code of patient's primary residence at the time tumor was diagnosed. NAACCR Item #90. Derived from County_at_DX_N90.

  • state: State of patient's primary residence at the time of diagnosis (recoded). NAACCR Item #80. Derived from Addr_at_DX_State_Recoded.

  • florida_resident: Patient's primary state of residence was Florida at time of diagnosis. NAACCR Item #80. Derived from Addr_at_DX_State_Recoded.

  • country: Country of patient's primary residence at time of diagnosis (recoded). NAACCR Item #102. Derived from Addr_at_Dx_Country_Recoded.

  • birth_country: Country of Birthplace (recoded). NAACCR Item #254. Derived from Birthplace_Country_Recoded.

  • birth_state: State of Birthplace (recoded). NAACCR Item #254. Derived from Birthplace_State_Abrv_Recoded.

  • primary_payer: Primary Payer at Diagnosis (recoded). NAACCR Item #630. Derived from Dx_Primary_Payor_Recoded.

  • cancer_reporting_source: Type of Reporting Source. NAACCR Item #500. Derived from Type_of_Reporting_Source_N500.

  • cancer_ICDO3_conversion: ICD-O-3 Conversion Flag. NAACCR Item #2116. Derived from ICDO3_Conversion_FL_N2116.

  • cancer_laterality: Laterality at Diagnosis. NAACCR Item #410. Derived from Laterality_N410.

  • cancer_grade: Grade, Differentiation, or Cell Lineage Indicator (SEER/CCCR). NAACCR Item #440. Derived from Grade_N440.

  • cancer_ICDO3_histology: Histologic Type ICD-O-3. NAACCR Item #522. Derived from Histologic_Type_ICDO3_N522.

  • cancer_ICDO3_behavior: Behavior Code ICD-O-3. NAACCR Item #523. Derived from Behavior_Code_ICDO3_N523.

  • cancer_ICDO3_morphology: Morphology Code ICD-O-3 (Type and Behavior). NAACCR Item #521. Derived from Histologic_Type_ICDO3_N522, Behavior_Code_ICDO3_N523.

  • seer_stage_1977: SEER Summary Stage 1977. NAACCR Item #760. Derived from SEER_Summ_Stage_1977_N760.

  • seer_stage_2000: SEER Summary Stage 2000. NAACCR Item #759. Derived from SEER_Summ_Stage_2000_N759.

  • seer_stage: SEER Stage from 2000 falling back to 1977. NAACCR Item #759. Derived from seer_stage_1977, seer_stage_2000.

  • seer_stage_derived_1977: Derivation of SEER Summary Stage 1977. NAACCR Item #3040. Derived from Derived_SS1977_FL_N3040.

  • seer_stage_derived_2000: Derivation of SEER Summary Stage 2000. NAACCR Item #3050. Derived from Derived_SS2000_FL_N3050.

  • tobacco_cigarette: Cigarette smoking. NAACCR Item #9965. Derived from FCDS_Tob_Use_Cigarette_N1300.

  • tobacco_other: Smoking tobacco products other than cigarettes (e.g., pipes, cigars, kreteks). NAACCR Item #9966. Derived from FCDS_Tob_Use_OthSmoke_N1300.

  • tobacco_smokeless: Smokeless tobacco products (e.g, chewing tobacco, snuff, etc.). NAACCR Item #9967. Derived from FCDS_Tob_Use_Smokeless_Tob_N1300.

  • tobacco_nos: Tobacco NOS, includes use of e-cigarettes and vaporizers. NAACCR Item #9968. Derived from FCDS_Tob_Use_NOS_N1300.

FCDS Data

Users must request the data from FCDS directly, via the FCDS Data Request webpage.

FCDS Recoding

This section will discuss the formatting for the FCDS recoding yaml file.

References

https://fcds.med.miami.edu/

See also