rv_create_risk_vector: Create risk vector based on ratio, number of places, or data...

Description Usage Arguments Value Examples

View source: R/rv_create_risk_vector.R

Description

Create risk vector based on ratio, number of places, or data frame

Usage

1
2
3
4
5
6
rv_create_risk_vector(
  risk_ratio,
  total_places,
  risk_places = NULL,
  risk_names = NULL
)

Arguments

risk_ratio

A numeric vector or a data frame with two columns, 'Risk' and 'Ratio'

total_places

Numeric. Gives the total length of the output vector.

risk_places

A numeric vector or a data frame with two columns, 'Risk' and 'Places'

risk_name

If a numeric vector given in previous parameters, defines the name of the risk.

Value

A character vector with length equal to total_places.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
rv_create_risk_vector(risk_ratio = 0.1,
                      total_places = 100)
table(
  rv_create_risk_vector(risk_ratio = 0.1,
                        total_places = 100) 
)

ratio <- tibble::tribble(~Risk, ~Ratio,
                         "Hospitalization", 0.3,
                         "Death", 0.1)

rv_create_risk_vector(risk_ratio = ratio,
                      total_places = 100)

table(
  rv_create_risk_vector(risk_ratio = ratio,
                        total_places = 100)
)

EDJNet/riskviewer documentation built on Dec. 17, 2021, 5:37 p.m.