function that iterates and assigns based on value in R
问题 I'm looking to write a function that iterates through a list of accounts each with a value associated, and assign that account with one of the names in a list of names. The list of names will have values associated and I would like the assigned name to be the one with the least value. name totalvalue Jeff 54 Christy 43 Matt 29 Jessica 19 accounts value name acc1 8 acc2 7 acc3 7 acc4 7 acc5 6 acc6 6 acc7 5 acc8 3 What I would like is to iterate through the accounts list and look at the names