Say I have three individuals and I know the payment they require to enter different amounts of land into a scheme. I want to know how much land each participant would enter into the scheme for a given payment rate. I want them to enter the max amount they are willing for that payment rate. Previously I did this with a long ifelse statement, but that will not run inside a loop, so I'm looking for an alternative.
In this example, I've excluded a load of areas so it just presents as if participants can enter 50, 49 or 1 unit(s) of area.
paym_sh1a=200
paym_area_50 <- 250, 150, 210
paym_area_49 <- 240, 130, 190
paym_area_1 <- 100, 20, 90
area_enrolled<-
ifelse(paym_area_50<paym_sh1a,50,ifelse(paym_area_49<paym_sh1a,49,
[...],ifelse(paym_area_1<paym_sh1a,1,0)))))
Aucun commentaire:
Enregistrer un commentaire