Author

J Bridge

Code
library(RiskCom)
library(ggplot2)

Urinary function waffle plots

Code
waffles(
  icons = c("veryhappy", "happy", "neutral", "sad", "verysad"),
  percentages = c(72, 21, 5, 2, 0),
  legend = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")
)

Code
waffles(
    icons = c("veryhappy", "happy", "neutral", "sad", "verysad"),
  percentages = c(39, 38, 14, 6, 3),
  legend = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")
)

Code
waffles(
  icons = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4"),
  percentages = c(77, 9, 5, 5, 4),
  legend = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")
)

Code
waffles(
  icons = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4"),
  percentages = c(44, 15, 11, 12, 18),
  legend = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")
)

Code
waffles(
  icons = c("underwear", "pad1", "pad2", "pad3"),
  percentages = c(96, 2, 1, 1),
  legend = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
)

Code
waffles(
  icons = c("underwear", "pad1", "pad2", "pad3"),
  percentages = c(65, 26, 5, 4),
  legend = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
)

Code
icons1 = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4")
icons2 = c("veryhappy", "happy", "neutral", "sad", "verysad")

legend1 = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")
legend2 = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")

percentages = c(70,9,0,0,0, 2,6,0,0,0, 0,3,1,0,0, 1,2,2,0,0, 0,1,2,1,0)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Code
icons1 = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4")
icons2 = c("veryhappy", "happy", "neutral", "sad", "verysad")

legend1 = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")
legend2 = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")

percentages = c(33,13,0,0,0, 3,11,2,0,0, 0,6,4,0,0, 1,5,3,1,0, 1,4,5,5,3)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Code
icons1 = c("underwear", "pad1", "pad2", "pad3")
icons2 = c("veryhappy", "happy", "neutral", "sad", "verysad")

legend1 = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
legend2 = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")

percentages = c(73,20,4,1,0, 0,1,1,0,0, 0,0,0,0,0, 0,0,0,0,0)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Code
icons1 = c("underwear", "pad1", "pad2", "pad3")
icons2 = c("veryhappy", "happy", "neutral", "sad", "verysad")

legend1 = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
legend2 = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")

percentages = c(34,24,4,1,0, 3,13,8,2,1, 0,0,2,2,1, 0,0,1,2,2)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Code
icons1 = c("underwear", "pad1", "pad2", "pad3")
icons2 = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4")

legend1 = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
legend2 = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")

percentages = c(76,8,4,5,3, 0,0,1,1,1, 0,0,0,0,0, 0,0,0,0,1)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Code
icons1 = c("underwear", "pad1", "pad2", "pad3")
icons2 = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4")

legend1 = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
legend2 = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")

percentages = c(42,11,6,4,2, 3,3,4,7,9, 0,0,0,1,4, 0,0,0,0,4)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Leak free and pad free at baseline

Code
waffles(
  icons = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4"),
  percentages = c(51,15,10,11,13),
  legend = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")
)

Code
waffles(
  icons = c("underwear", "pad1", "pad2", "pad3"),
  percentages = c(70,24,3,3),
  legend = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
)

Code
icons1 = c("underwear", "pad1", "pad2", "pad3")
icons2 = c("sun", "raindrop1", "raindrop2", "raindrop3", "raindrop4")

legend1 = c("No pads per day", "One pad per day", "Two pads per day", "Three or more pads per day")
legend2 = c("Rarely or never leaking", "Leaking once a week", "Leaking more than once a week", "Leaking once a day", "Leaking more than once a day")

percentages = c(48,11,6,4,1, 2,3,5,7,7, 0,0,0,1,3, 0,0,0,0,2)
waffles(icons=icons1, legend=legend1, percentages=percentages, 
        icons2=icons2, legend2=legend2)

Sexual function waffle plots

Code
waffles(
    icons = c("veryhappy", "happy", "neutral", "sad", "verysad"),
  percentages = c(48, 18, 17, 11, 6),
  legend = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")
)

Code
waffles(
    icons = c("veryhappy", "happy", "neutral", "sad", "verysad"),
  percentages = c(19, 18, 21, 23, 19),
  legend = c("No problem", "Very small problem", "Small problem", "Moderate problem", "Big problem")
)

Code
waffles(
  icons = c("dot5", "dot3", "dot2", "dot1"),
  percentages = c(57, 23, 10, 10),
  legend = c("Firm enough for intercourse", "Firm enough for masturbation and foreplay only", "Not firm enough for any sexual activity", "None at all")
)

Code
waffles(
  icons = c("dot5", "dot3", "dot2", "dot1"),
  percentages = c(10, 24, 17, 49),
  legend = c("Firm enough for intercourse", "Firm enough for masturbation and foreplay only", "Not firm enough for any sexual activity", "None at all")
)

Code
icons1 = c("dot5", "dot3", "dot2", "dot1")
icons2 = c("blank", "pill")

legend1 = c("Firm enough for intercourse", "Firm enough for masturbation and foreplay only", "Not firm enough for any sexual activity", "None at all")
legend2 = c("", "Used medication or device")

percentages  = c(52,5, 19,4, 8,2, 9,1)
waffles(icons=icons1, legend=legend1, percentages = percentages , 
        icons2=icons2, legend2=legend2,
        offset_x=0, offset_y=0, icon_size2 = 0.06)

Code
icons1 = c("dot5", "dot3", "dot2", "dot1")
icons2 = c("blank", "pill")

legend1 = c("Firm enough for intercourse", "Firm enough for masturbation and foreplay only", "Not firm enough for any sexual activity", "None at all")
legend2 = c("", "Used medication or device")

percentages  = c(3,7, 6,18, 6,11, 23,26)
waffles(icons=icons1, legend=legend1, percentages  = percentages, 
        icons2=icons2, legend2=legend2,
        offset_x=0, offset_y=0, icon_size2 = 0.06)

Natural erections at baseline

Code
waffles(
  icons = c("dot5", "dot3", "dot2", "dot1"),
  percentages = c(17,29,16,38),
  legend = c("Firm enough for intercourse", "Firm enough for masturbation and foreplay only", "Not firm enough for any sexual activity", "None at all")
)

Code
icons1 = c("dot5", "dot3", "dot2", "dot1")
icons2 = c("blank", "pill")

legend1 = c("Firm enough for intercourse", "Firm enough for masturbation and foreplay only", "Not firm enough for any sexual activity", "None at all")
legend2 = c("", "Used medication or device")

percentages  = c(6,11,7,22,5,11,13,25)
waffles(icons=icons1, legend=legend1, percentages  = percentages, 
        icons2=icons2, legend2=legend2,
        offset_x=0, offset_y=0, icon_size2 = 0.06)

Bar charts

Code
Problem <- c(rep("No problem" , 5) , rep("Very small problem" , 5) , rep("Small problem" , 5) , rep("Moderate problem" , 5), rep("Big problem" , 5))
Leakage <- rep(c("Rarely or never" , "About once a week", "More than once a week", "About once a day", "More than once a day") , 5)
Frequency <- c(1374,36,8,10,3, 156,123,61,51,18, 9,13,23,31,34, 2,2,5,11,20, 1,0,0,0,14)
data <- data.frame("Problem"=factor(Problem, 
                          levels=c("No problem","Very small problem","Small problem","Moderate problem","Big problem","Unknown")), 
                   "Leakage"=factor(Leakage, levels=c("Rarely or never" , "About once a week", "More than once a week", "About once a day", "More than once a day"))
                   , "Frequency"=Frequency)

ggplot(data, aes(x=Leakage, y=Frequency)) + 
    geom_col(aes(fill=Problem))+
  scale_x_discrete(labels=c(
    "Rarely or never"="Rarely \n or never",
    "About once a week"= "About once \n a week",
    "More than once a week"="More than \n once a week",
    "About once a day"= "About once \n a day",
    "More than once a day"="More than \n once a day"
  )) 

Code
Problem <- c(rep("No problem" , 5) , rep("Very small problem" , 5) , rep("Small problem" , 5) , rep("Moderate problem" , 5), rep("Big problem" , 5))
Leakage <- rep(c("Rarely or never" , "About once a week", "More than once a week", "About once a day", "More than once a day") , 5)
Frequency <- c(468,37,10,19,10, 162,152,87,94,60, 1,23,51,48,71, 0,3,3,8,64, 0,0,0,3,46)
data <- data.frame("Problem"=factor(Problem, 
                          levels=c("No problem","Very small problem","Small problem","Moderate problem","Big problem","Unknown")), 
                   "Leakage"=factor(Leakage, levels=c("Rarely or never" , "About once a week", "More than once a week", "About once a day", "More than once a day"))
                   , "Frequency"=Frequency)

ggplot(data, aes(x=Leakage, y=Frequency)) + 
    geom_col(aes(fill=Problem))+
  scale_x_discrete(labels=c(
    "Rarely or never"="Rarely \n or never",
    "About once a week"= "About once \n a week",
    "More than once a week"="More than \n once a week",
    "About once a day"= "About once \n a day",
    "More than once a day"="More than \n once a day"
  )) 

Code
Problem <- c(rep("No problem" , 4) , rep("Very small problem" , 4) , rep("Small problem" , 4) , rep("Moderate problem" , 4), rep("Big problem" , 4))
Pads <- rep(c("None" , "1/day", "2/day", ">3/day") , 5)
Frequency <- c(1427,5,2,0, 392,18,1,0, 89,14,4,3, 29,6,3,2, 4,0,1,9)
data <- data.frame("Problem"=factor(Problem, 
                          levels=c("No problem","Very small problem","Small problem","Moderate problem","Big problem","Unknown")), 
                   "Pads"=factor(Pads, levels=c("None" , "1/day", "2/day", ">3/day", "Unknown"))
                   , "Frequency"=Frequency)

ggplot(data, aes(x=Pads, y=Frequency, fill=Problem)) + 
    geom_col()+
  scale_x_discrete(labels=c(
    "None"="None",
    "1/day"="1 pad \n per day", 
    "2/day"= "2 pads \n per day", 
    ">3/day"="3 pads \n or more \n per day"
  )) 

Code
Problem <- c(rep("No problem" , 4) , rep("Very small problem" , 4) , rep("Small problem" , 4) , rep("Moderate problem" , 4), rep("Big problem" , 4))
Pads <- rep(c("None" , "1/day", "2/day", ">3/day") , 5)
Frequency <- c(497,46,4,0, 363,183,8,5, 57,107,23,6, 10,26,23,17, 2,10,13,27)
data <- data.frame("Problem"=factor(Problem, 
                          levels=c("No problem","Very small problem","Small problem","Moderate problem","Big problem","Unknown")), 
                   "Pads"=factor(Pads, levels=c("None" , "1/day", "2/day", ">3/day", "Unknown"))
                   , "Frequency"=Frequency)

ggplot(data, aes(x=Pads, y=Frequency, fill=Problem)) + 
    geom_col()+
  scale_x_discrete(labels=c(
    "None"="None",
    "1/day"="1 pad \n per day", 
    "2/day"= "2 pads \n per day", 
    ">3/day"="3 pads \n or more \n per day"
  ))

Code
Leakage = c(rep("Rarely or never", 4), 
            rep("About once a week", 4), rep("More than once a week", 4),
            rep("About once a day", 4), rep("More than once a day", 4))
Pads = rep(c("None", "1 pad per day", "2 pads per day", "3 or more pads per day"), 5)
Freq = c(583,35,1,0, 158,48,1,1, 82,61,1,2, 60,99,10,1, 21,120,55,49)
data = data.frame("Leakage"=factor(Leakage, levels=c("Rarely or never", "About once a week", "More than once a week","About once a day", "More than once a day")), "Pads"=factor(Pads, levels=c("None", "1 pad per day", "2 pads per day", "3 or more pads per day")), "Freq"=Freq)
ggplot(data, aes(fill=Pads, y=Freq, x=Leakage))+
  geom_col()+
  ylab("Number of participants")+
  scale_x_discrete(labels=c(
    "Rarely or never"="Rarely \n or never",
    "About once a week"= "About once \n a week", 
    "More than once a week"="More than \n once a week",
    "About once a day"="About once \n a day", 
    "More than once a day"="More than \n once a day",
    "Missing"="Missing"
    
  ))