## Data dfr <- params$dfr dfr <- dfr[, c("PHASE", "IDENTIFIED_CRITERIA", "SCORE_MEN", "SCORE_WOMEN", "SCORE_GLOBAL")] dfr$IDENTIFIED_CRITERIA <- as.character(dfr$IDENTIFIED_CRITERIA) colnames(dfr) <- c("phase", "Criteria", "Men", "Women", "Global") dfr <- tidyr::gather(dfr, group, value, Men:Global) ## Split by phase flow <- dfr[dfr$phase == "Flowering", ] harv <- dfr[dfr$phase == "Harvest", ] stor <- dfr[dfr$phase == "Storage", ] ## Sort by number of votes temp <- flow[flow$group == "Global", c("Criteria", "value")] orden <- temp$Criteria[sort(temp$value, decreasing = TRUE, index.return = TRUE)$ix] flow$Criteria <- factor(flow$Criteria, levels = orden) temp <- harv[harv$group == "Global", c("Criteria", "value")] orden <- temp$Criteria[sort(temp$value, decreasing = TRUE, index.return = TRUE)$ix] harv$Criteria <- factor(harv$Criteria, levels = orden) temp <- stor[stor$group == "Global", c("Criteria", "value")] orden <- temp$Criteria[sort(temp$value, decreasing = TRUE, index.return = TRUE)$ix] stor$Criteria <- factor(stor$Criteria, levels = orden) ## Count number of votes nvmflow <- sum(flow[flow$group == "Men", "value"], na.rm = TRUE) nvmharv <- sum(harv[harv$group == "Men", "value"], na.rm = TRUE) nvmstor <- sum(stor[stor$group == "Men", "value"], na.rm = TRUE) nvwflow <- sum(flow[flow$group == "Women", "value"], na.rm = TRUE) nvwharv <- sum(harv[harv$group == "Women", "value"], na.rm = TRUE) nvwstor <- sum(stor[stor$group == "Women", "value"], na.rm = TRUE) ## Count number of voters nmflow <- round(nvmflow / 6) nmharv <- round(nvmharv / 6) nmstor <- round(nvmstor / 6) nwflow <- round(nvwflow / 6) nwharv <- round(nvwharv / 6) nwstor <- round(nvwstor / 6) ## Compute percentage adjusted by gender flowp <- flow[flow$group == "Global", ] flowp$value <- flowp$value / (nvmflow + nvwflow) temp <- flow[flow$group != "Global", ] temp[temp$group == "Men", "value"] <- temp[temp$group == "Men", "value"] / nvmflow / 2 temp[temp$group == "Women", "value"] <- temp[temp$group == "Women", "value"] / nvwflow / 2 temp <- docomp("sum", "value", "Criteria", "phase", temp) temp$group <- "Global adjusted" flowp <- rbind(flowp, temp) flowp$value <- round(flowp$value * 100, 1) harvp <- harv[harv$group == "Global", ] harvp$value <- harvp$value / (nvmharv + nvwharv) temp <- harv[harv$group != "Global", ] temp[temp$group == "Men", "value"] <- temp[temp$group == "Men", "value"] / nvmharv / 2 temp[temp$group == "Women", "value"] <- temp[temp$group == "Women", "value"] / nvwharv / 2 temp <- docomp("sum", "value", "Criteria", "phase", temp) temp$group <- "Global adjusted" harvp <- rbind(harvp, temp) harvp$value <- round(harvp$value * 100, 1) storp <- stor[stor$group == "Global", ] storp$value <- storp$value / (nvmstor + nvwstor) temp <- stor[stor$group != "Global", ] temp[temp$group == "Men", "value"] <- temp[temp$group == "Men", "value"] / nvmstor / 2 temp[temp$group == "Women", "value"] <- temp[temp$group == "Women", "value"] / nvwstor / 2 temp <- docomp("sum", "value", "Criteria", "phase", temp) temp$group <- "Global adjusted" storp <- rbind(storp, temp) storp$value <- round(storp$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: What do you look for in a new variety of potato when the crop is at the flowering/harvest/post-harvest stage? In other words: When do you say that a variety is good or bad, when evaluating at this stage?
A list is compiled of all the criteria mentioned by the different participants (i.e. free listing). Each criterium is listed and written on a paper bag (or card with accompanying container). Then, in order to select the most important traits for farmers a voting process is conducted.
Farmers are requested to select the three criteria that each considers the most important with the following scheme. They can give:
Votes are recorded for men and women.
r if (nrow(flow) == 0) {"There were no data for selection criteria at flowering."}
r if (all(is.na(flow$Criteria))) {"There were no data for selection criteria at flowering."}
if (nrow(flow) > 0 && !all(is.na(flow$Criteria))) { ggplot(flow, aes(x = group, y = value, fill = Criteria)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for selection criteria of new varieties at flowering stage", x = "Group", y = "Number of votes") + geom_text(aes(label = value), vjust = 1.6, color = "white", position = position_dodge(0.9), size = 3) }
r if (nrow(flow) > 0 && !all(is.na(flow$Criteria))) {"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."}
if (nrow(flow) > 0 && !all(is.na(flow$Criteria))) { ggplot(flowp, aes(x = group, y = value, fill = Criteria)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for selection criteria of new varieties at flowering 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) }
r if (nrow(harv) == 0) {"There were no data for selection criteria at harvest."}
r if (all(is.na(harv$Criteria))) {"There were no data for selection criteria at harvest."}
if (nrow(harv) > 0 && !all(is.na(harv$Criteria))) { ggplot(harv, aes(x = group, y = value, fill = Criteria)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for selection criteria of new varieties at 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) }
r if (nrow(harv) > 0 && !all(is.na(harv$Criteria))) {"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."}
if (nrow(harv) > 0 && !all(is.na(harv$Criteria))) { ggplot(harvp, aes(x = group, y = value, fill = Criteria)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for selection criteria of new varieties at 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) }
r if (nrow(stor) == 0) {"There were no data for selection criteria at post-harvest."}
r if (all(is.na(stor$Criteria))) {"There were no data for selection criteria at post-harvest."}
if (nrow(stor) > 0 && !all(is.na(stor$Criteria))) { ggplot(stor, aes(x = group, y = value, fill = Criteria)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for selection criteria of new varieties 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) }
r if (nrow(stor) > 0 && !all(is.na(stor$Criteria))) {"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."}
if (nrow(stor) > 0 && !all(is.na(stor$Criteria))) { ggplot(storp, aes(x = group, y = value, fill = Criteria)) + geom_bar(stat = "identity", position = "dodge", color = "black") + labs(title = "Voting for selection criteria of new varieties 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) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.