cvd_risk | R Documentation |
Calculate risk of cardiovascular disease
cvd_risk(
x = NULL,
method = "D'Agostino_2008",
sex,
age,
total_cholesterol,
hdl,
systolic,
bp_treated,
diabetes,
smoker,
points = TRUE,
...
)
## Default S3 method:
cvd_risk(
x = NULL,
method = "D'Agostino_2008",
sex,
age,
total_cholesterol,
hdl,
systolic,
bp_treated,
diabetes,
smoker,
points = TRUE,
...
)
## S3 method for class 'data.frame'
cvd_risk(
x = NULL,
method = "D'Agostino_2008",
sex,
age,
total_cholesterol,
hdl,
systolic,
bp_treated,
diabetes,
smoker,
points = TRUE,
combine = TRUE,
...
)
x |
optional data frame. If provided, the other arguments will be taken as column names under the assumption that each row represents a separate person, and each column provides one of the requested pieces of information |
method |
character. Currently only |
sex |
character scalar indicating either sex for one person (i.e.,
|
age |
either a numeric scalar indicating age for one person, or a
character scalar indicating the name of the column in |
total_cholesterol |
same as |
hdl |
same as |
systolic |
same as |
bp_treated |
either a logical scalar indicating whether a person is
taking blood pressure medication, or a character scalar pointing to the
column in |
diabetes |
same as |
smoker |
same as |
points |
logical. Return as points (default) or risk percentage? |
... |
arguments passed to other methods |
combine |
logical. Give results as a list of |
One or more risk profiles (for default method with points = TRUE
, or for data frames with combine = FALSE & points = TRUE
). Otherwise numeric risk percentage (for points = FALSE
, scalars and data frames) or an integer vector (for data frames with combine = TRUE & points = FALSE
)
cvd_risk(sex = "Female", age = 111, total_cholesterol = 111, systolic = 111,
hdl = 11, bp_treated = FALSE, diabetes = TRUE, smoker = TRUE)
df <- data.frame(
sex = sample(c("Male", "Female"), 5, TRUE),
age = sample(30:100, 5, TRUE),
tc = sample(150:300, 5, TRUE),
hdl = sample(30:70, 5, TRUE),
sbp = sample(100:180, 5, TRUE),
bpmed = sample(c(TRUE, FALSE), 5, TRUE),
diabetes = sample(c(TRUE, FALSE), 5, TRUE),
smoker = sample(c(TRUE, FALSE), 5, TRUE)
)
cvd_risk(
df, sex = "sex", age = "age",
total_cholesterol = "tc", hdl = "hdl",
systolic = "sbp", bp_treated = "bpmed",
diabetes = "diabetes", smoker = "smoker",
combine = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.