I am dealing with a dataset that has confirmation margins for individuals confirmed in the US Senate. The dataset I'm pulling from has them coded as factors with each possible margin (100/0, 50/50, etc) as a different level. I need to assign the values of these margins to a column in another data frame. Right now my code looks something like:
for (i in fedjud_scotus$Judge.Name) {
justice_data$confirm_margin[justice_data$justice==i] <- fedjud_scotus$Ayes.Nays[fedjud_scotus$Judge.Name==i]
}
where fedjud_scotus
is the original data frame, and justice_data is the new data frame I'm trying to add confirmation data into. Right now, this is only moving the level (ex. 3,4,8), not the actual margin (64/36, 93/7, etc). Is there a way to get the actual margin data to move where I want it?