Learn R Programming

graphPAF (version 1.0.2)

plot.rf.data.frame: Create a fan_plot of a rf.data.frame object

Description

Create a fan plot displaying approximate PAF, risk factor prevalence and risk ratios

Usage

# S3 method for rf.data.frame
plot(
  x,
  type = "f",
  rf_prevmarks = c(0.02, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.9),
  ormarks = c(1.05, 1.1, 1.4, 1.7, 2, 3),
  ...
)

Value

fanplot or PAF nomogram (each is a ggplot2 object)

Arguments

x

A rf.data.frame object

type

A character representing the type of plot. "f" for a fan_plot, "n" for a PAF nomogram and "rn" for a reverse PAF nomogram. See Ferguson et al.. "Graphical comparisons of relative disease burden across multiple risk factors." BMC medical research methodology 19, no. 1 (2019): 1-9 for more details

rf_prevmarks

Axis marks for risk factor prevalence (only used for type="n" and type = "rn") Default c(0.02, 0.05,0.1,0.2,0.3,0.4,0.5,0.7,0.9)

ormarks

Axis marks for odds ratios (only used for type="n" and type = "rn") Default c(1.05,1.1,1.4,1.7,2.0,3.0)

...

Other arguments that can be passed to the plotting routine

References

Ferguson, J., O’Leary, N., Maturo, F., Yusuf, S. and O’Donnell, M., 2019. Graphical comparisons of relative disease burden across multiple risk factors. BMC medical research methodology, 19(1), pp.1-9.

Examples

Run this code
rfs <- rf_summary(rf_names=c('Hypertension','Inactivity','ApoB/ApoA',
'Diet','WHR','Smoking','Cardiac causes','Alcohol','Global Stress','Diabetes'),
rf_prev=c(.474,.837,.669,.67,.67,.224,.049,.277,.144,.129),
risk=c(1.093,0.501,0.428,0.378,0.294,0.513,1.156,0.186,0.301,0.148),log=TRUE)
# fanplot
plot(rfs,type="f")
# nomogram
plot(rfs,type="n")
# reverse nomogram
plot(rfs,type="rn")

Run the code above in your browser using DataLab