[Solved] Calculate simple function with R [closed]


As Brian Hannays says: Change the definition of Alive.prob to 1-Dead.prob. A good programming habit is to try to avoid redundant (and then possibly conflicting) definitions…

function(Dead.prob=.010,Dead.cost=40000,Alive.prob=1-Dead.prob,Alive.cost=50000,high=100,p.payoff=1) {
  return((Dead.prob * Dead.cost) + (Alive.prob * Alive.cost))
}

solved Calculate simple function with R [closed]