Description Usage Arguments Details Value Examples
View source: R/extract_outcome-function.R
This function makes a list of subjects with either event or non-event outcome, that visit healthcare providers up to the predefined latest date.
1 2 3 4 5 6 7 8 9 10 | extract_outcome(
population,
icd10_event,
latest_event = min,
day_to_event = -1,
icd10_nonevent,
latest_nonevent = max,
day_to_nonevent = 0,
verbose = T
)
|
population |
Target population data, a data frame with rows for visits
and standardized columns (please see Details below). If only a single
healthcare provider, then make |
icd10_event |
Event code, a character of ICD-10 code for either diagnosis or procedure, that identify subjects with event outcome. This parameter should be a regular expression if detecting >1 ICD-10 codes. The detection is not exact but anywhere within the character sequence; thus, the code with more than k-mer will be extracted. |
latest_event |
Latest date of event, a function to choose
|
day_to_event |
Day to event, an integer to adjust |
icd10_nonevent |
Non-event code, a character of ICD-10 code for either
diagnosis or procedure, that identify subjects with non-event outcome. This
parameter should be a regular expression if detecting >1 ICD-10 codes. Make
this parameter as |
latest_nonevent |
Latest date of non-event, a function to choose
|
day_to_nonevent |
Day to non-event, an integer to adjust
|
verbose |
Verbosity, a logical indicating whether progress should be shown. |
Target population data consisted visit_id
,subject_id
,
healthcare_id
, admission_date
, code
, and
db_start_date
. Columns of visit_id
,subject_id
, and
healthcare_id
are characters of identification numbers identifying
respectively unique visits, subjects, and healthcare providers. Columns of
admission_date
and db_start_date
are dates of subject admission
in a visit and database start of recording period, respectively. Column of
code
is a character of ICD-10 code for either diagnosis or procedure
regardless the number of digit or k-mer.
Subject list, a data frame with rows for unique subjects and columns
of subject_id
, latest_date
, and outcome
. The last column
is a factor of which non-event is the first class between non-event and
event.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Create input example
data(visit_cap)
data(visit_ffs)
data(visit_drg)
data(diagnosis)
population=
list(visit_cap,visit_ffs,visit_drg) %>%
lapply(select,visit_id,subject_id,healthcare_id,admission_date) %>%
do.call(rbind,.) %>%
left_join(diagnosis,by='visit_id') %>%
filter(!code_type%in%c('Admission diagnosis')) %>%
select(-code_type) %>%
mutate(db_start_date=as.Date('2015-01-01')) %>%
.[!duplicated(.),]
## Extract outcome of subjects
outcome=extract_outcome(population,'O1[4-5]',min,-1,'Z3[3-7]',max,0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.