require(fmsb)
x <- PrefYLL2010
COL <- ifelse(x$PNAME=="Nagano", "blue", ifelse(x$PNAME=="Okinawa", "red",
ifelse(x$PNAME=="Shiga", "green", "lightgrey")))
LWD <- ifelse(x$PNAME=="Nagano", 2, ifelse(x$PNAME=="Okinawa", 2, ifelse(x$PNAME=="Shiga", 2, 1)))
LTY <- ifelse(x$PNAME=="Nagano", 1, ifelse(x$PNAME=="Okinawa", 1, ifelse(x$PNAME=="Shiga", 1, 3)))
VX <- c("Cancer","Heart\n Disease","Cerebrovascular\n Disease","Top3","Pneumonia",
"Accident","(Traffic\n Accident)","Suicide","Kidney\n Failure","Liver\n Disease",
"Diabetes","Hypertension","Tuberculosis")
males <- x[,3:15]
females <- x[,16:28]
layout(t(1:2))
radarchart(males, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX,
title="YLLs in males (2010)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)")
radarchart(females, maxmin=FALSE, pcol=COL, axistype=2, pty=32, plty=LTY, plwd=LWD, vlabels=VX,
title="YLL in females (2010)\n (Blue: Nagano, Green: Shiga,\n Red: Okinawa, Gray: Others)")
Run the code above in your browser using DataLab