trans_norm_day: Transform medical history by normalizing day up to maximum...

Description Usage Arguments Value Examples

View source: R/trans_norm_day-function.R

Description

This function transforms each medical history from day interval to normalized one based on maximum period of database, inversely. For example, if maximum period is 730 days, and a code medical history is encountered at 365 days at the latest up to a visit by a subject, then this function will normalize this number into (730-365)/730=0.5. Therefore, normalized values of 0 and 1 are respectively day intervals of 730 and 0. Missing value or NA day interval is also normalized to 0.

Usage

1
trans_norm_day(tidy_set, day_cutoff, verbose = T)

Arguments

day_cutoff

Cutoff of the maximum days, a non-negative numeric that is used for cutoff. If day interval of a medical is more than the cutoff, then that medical history is transformed to 0. Missing value or NA is also transformed to 0.

verbose

Verbosity, a logical indicating whether progress should be shown.

mh_table

Target population data, a data frame with rows for visits and standardized columns (please see Details below). This is an output of extract_medical_history().

Value

A TidySet (i.e. ExpressionSet) containing the visits of subjects in medical history and the outcome datasets. Since a code may be encountered before db_start_date, causing the value returns NA to denote censored data, that medical history is transformed to 0.

Examples

1
2
3
4
5
## Create input example
data(medhistdata)

## Transform medical history by normalizing day up to maximum database days
mh_norm_day=trans_norm_day(medhistdata,730)

herdiantrisufriyana/medhist documentation built on June 24, 2021, 3:41 a.m.