## Data dfr <- params$dfr dfr <- dfr[, c("REP", "INSTN", "STYPE", "SCORE_MEN", "SCORE_WOMEN", "SCORE_GLOBAL")] colnames(dfr)[4:6] <- c("Men", "Women", "Global") nr <- length(unique(dfr$REP)) ds <- docomp("sum", c("Men", "Women", "Global"), "INSTN", dfr = dfr) ds <- tidyr::gather(ds, group, value, Men:Global) ## Sort by number of votes temp <- ds[ds$group == "Global", c("INSTN", "value")] orden <- temp$INSTN[sort(temp$value, decreasing = TRUE, index.return = TRUE)$ix] ds$INSTN <- factor(ds$INSTN, levels = orden) ## Count number of votes nvm <- sum(ds[ds$group == "Men", "value"], na.rm = TRUE) nvw <- sum(ds[ds$group == "Women", "value"], na.rm = TRUE) ## Count number of voters nm <- round(nvm / 6 / nr) nw <- round(nvw / 6 / nr) ## Compute percentage adjusted by gender dsp <- ds[ds$group == "Global", ] dsp$value <- dsp$value / (nvm + nvw) temp <- ds[ds$group != "Global", ] temp[temp$group == "Men", "value"] <- temp[temp$group == "Men", "value"] / nvm / 2 temp[temp$group == "Women", "value"] <- temp[temp$group == "Women", "value"] / nvw / 2 temp <- docomp("sum", "value", "INSTN", dfr = temp) temp$group <- "Global adjusted" dsp <- rbind(dsp, temp) dsp$value <- round(dsp$value * 100, 1)
A group of farmers, men and women, and other stakeholders are gathered and, after explanation of the overall objectives of the trial, they are asked to identify their three personal favorite genotypes. Then, they are requested to vote by giving:
Votes are recorded for men and women.
The genotypes have been planted following a randomized complete block design with r nr
blocks. A group of men and women voted independently for the best genotypes at each block, so each men and women voted r nr
times.
ggplot(ds, aes(x = group, y = value, fill = INSTN)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for best genotypes at post-harvest stage", x = "Group", y = "Number of votes") + geom_text(aes(label = value), vjust = 1.6, color = "white", position = position_dodge(0.9), size = 3)
Below a percentage graph is shown. On the right panel the percentages are adjusted by gender, thus trying to reflect what would have been obtained if the number of men and women would be the same in the sample.
ggplot(dsp, aes(x = group, y = value, fill = INSTN)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for best genotypes at post-harvest stage", subtitle = "Percentages unadjusted and adjusted by gender", x = "Group", y = "Percentage of votes") + geom_text(aes(label = value), vjust = 1.6, color = "white", position = position_dodge(0.9), size = 3)
ft <- with(dfr, friedman(REP, INSTN, Men, group = TRUE)) ft$statistics ft$groups ft <- with(dfr, friedman(REP, INSTN, Men, group = FALSE)) ft$comparison
ft <- with(dfr, friedman(REP, INSTN, Women, group = TRUE)) ft$statistics ft$groups ft <- with(dfr, friedman(REP, INSTN, Women, group = FALSE)) ft$comparison
ft <- with(dfr, friedman(REP, INSTN, Global, group = TRUE)) ft$statistics ft$groups ft <- with(dfr, friedman(REP, INSTN, Global, group = FALSE)) ft$comparison
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.