I'm very new to R and am trying to facet_wrap raincloud plots. I am trying to facet_wrap by Hypothesis chosen (which has been binary coded), so ideally would like to plot proportion of confirmatory and disconfirmatory leads chosen by hypothesis.
Here is what I have so far:
my_data2 <- melt(my_data, id.vars = c("ID"), 
             measure.vars = c("Proportion.of.Disconfirmatory.Leads.Chosen","Proportion.of.Confirmatory.Leads.Chosen", "Hypothesis"), 
             variable.name = "Leads", "Hyp",
             value.name = "Proportion")
  plot3 <- ggplot(data = my_data2, aes(y = Proportion, x = Leads, fill = Leads)) +
    geom_flat_violin(position = position_nudge(x = .2, y = 0), alpha = .8) +
    geom_point(aes(y = Proportion, color = Leads), position = position_jitter(width = .15), size = .5, alpha = 0.8) +
    geom_boxplot(width = .1, guides = FALSE, outlier.shape = NA, alpha = 0.5) +
    facet_wrap(vars(Hypothesis), nrow = 2)+
    expand_limits(x = 5.25) +
    guides(fill = FALSE) +
    guides(color = FALSE) +
    scale_color_brewer(palette = "Spectral") +
    scale_fill_brewer(palette = "Spectral") +
    coord_flip() +
    theme_bw() 
  plot3
However, I am receiving this error:
"Error: At least one layer must contain all faceting variables: `Hypothesis`.
* Plot is missing `Hypothesis`
* Layer 1 is missing `Hypothesis`
* Layer 2 is missing `Hypothesis`
* Layer 3 is missing `Hypothesis`
* Layer 4 is missing `Hypothesis`" 
> dput(my_data)
structure(list(ID = c(2L, 5L, 23L, 34L, 35L, 48L, 53L, 59L, 71L, 
76L, 1L, 3L, 4L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 
17L, 18L, 19L, 20L, 21L, 22L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 
31L, 32L, 33L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 
46L, 47L, 49L, 50L, 51L, 52L, 54L, 55L, 56L, 57L, 58L, 60L, 61L, 
62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 72L, 73L, 74L, 75L, 
78L), Hypothesis = c(0L, 0L, 0L, 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333, 37.5, 60, 60, 
33.33333333, 33.33333333, 62.5, 30, 50, 50, 60, 62.5, 0, 41.66666667, 
55.55555556, 16.66666667, 66.66666667, 62.5, 50, 50, 35.71428571, 
25, 54.54545455, 44.44444444, 85.71428571, 50, 57.14285714, 40, 
57.14285714, 50, 36.36363636, 66.66666667, 71.42857143, 40, 40, 
46.66666667, 33.33333333, 33.33333333, 25, 25, 50, 25, 50, 66.66666667, 
0, 45.45454545, 66.66666667, 70, 60, 44.44444444, 50, 20, 16.66666667, 
50, 44.44444444, 66.66666667, 58.33333333, 30, 50, 54.54545455, 
33.33333333, 55.55555556, 40, 50, 50, 53.33333333, 25, 50, 62.5, 
50), Proportion.of.Confirmatory.Leads.Chosen = c(35.71428571, 
22.22222222, 100, 40, 66.66666667, 75, 66.66666667, 62.5, 40, 
40, 66.66666667, 66.66666667, 37.5, 70, 50, 50, 40, 37.5, 100, 
58.33333333, 44.44444444, 83.33333333, 33.33333333, 37.5, 50, 
50, 64.28571429, 75, 45.45454545, 55.55555556, 14.28571429, 50, 
42.85714286, 60, 42.85714286, 50, 63.63636364, 33.33333333, 28.57142857, 
60, 60, 53.33333333, 66.66666667, 66.66666667, 75, 75, 50, 75, 
50, 33.33333333, 100, 54.54545455, 33.33333333, 30, 40, 55.55555556, 
50, 80, 83.33333333, 50, 55.55555556, 33.33333333, 41.66666667, 
70, 50, 45.45454545, 66.66666667, 44.44444444, 60, 50, 50, 46.66666667, 
75, 50, 37.5, 50)), class = "data.frame", row.names = c(NA, -76L
))
> head(my_data)
  ID Hypothesis Sum.of.Disconfirmatory.Leads.Chosen Sum.of.Confirmatory.Leads.Chosen
1  2          0                                   9                                5
2  5          0                                   7                                2
3 23          0                                   0                                2
4 34          0                                   3                                2
5 35          0                                   4                                8
6 48          0                                   1                                3
  Proportion.of.Disconfirmatory.Leads.Chosen Proportion.of.Confirmatory.Leads.Chosen
1                                   64.28571                                35.71429
2                                   77.77778                                22.22222
3                                    0.00000                               100.00000
4                                   60.00000                                40.00000
5                                   33.33333                                66.66667
6                                   25.00000                                75.00000
I suspect that I have introduced the variable Hypothesis incorrectly in the code, however I have no idea where or how! I have tried to include it in sumld however am receiving this error when doing so:
    Error in fs[[1]](x, ...) : attempt to apply non-function
Thank you all in advance for your help.
 
    

