Before you upload csv: vote value as Value ADPi who voted as Author PNM first name as PNM.First.Name PNM last name as PNM.Last.Name PNM id as PNM.ID
(shouldn’t have to change anything if you’re downloading right from MyVote)
to run -> run button in top right and run all
library(dplyr)
df <- read.csv("og.pref.scores.csv")
## Here you can choose if you want to combine it with previous rounds or not
prev.df <- read.csv("sisterhood.scores.csv")
for each voter(Author), take the average of their scores as author_avg take the votes value and divide it by the author_avg to get standardized vote value
for each PNM sum their votes and divide by number of votes cast (to make sure ppl w extra/ not enough votes aren’t weighted too low or high)
df_standardized <- df %>%
# standardize by author
group_by(Author) %>%
mutate(
author_avg = mean(Value, na.rm = TRUE),
standardized_value = Value / author_avg
) %>%
ungroup() %>%
# compute per‑person sums and averages
group_by(PNM.First.Name, PNM.Last.Name) %>%
mutate(
num_votes = n(), # how many votes they have
total_standardized_score = sum(standardized_value, na.rm = TRUE), # sum of standardized
avg_standardized_score = total_standardized_score / num_votes # divide by vote count
) %>%
ungroup() %>%
# sort by your existing ID
arrange(PNM.ID)
Don’t need to show all of the columns since Author and comments don’t matter anymore
final_output <- df_standardized %>%
select(
PNM.ID,
PNM.First.Name,
PNM.Last.Name,
num_votes,
avg_standardized_score
)
write.csv(final_output, "test.csv", row.names = FALSE)
df <- read.csv("test.csv") # make sure to rename same as what you save it as
If you do not want to merge scores across rounds just comment out everything under this (highlight & command + shift + c)
output <- left_join(df, prev.df, by = c("PNM.ID", "PNM.First.Name", "PNM.Last.Name"))
# df_clean <- merged_scores %>%
# filter(!is.na(score_round1), !is.na(score_round2))
write.csv(output, "test.merge.csv", row.names = FALSE)