I'm trying to make a function that will print off the prize if function matches the 5,1 or 5,0.
Is this even possible with the below? I've tried various ways and manage to receive the same error:
powerball_numbers(5,1)
Error in powerball_numbers(5, 1) : unused argument (1)
# total Grand Prize
grand_prize <- 10000000
#M5 white balls and one red
w_5_r_1 <- c(5,1)
#Second Prize of $1,000,000
second_prize <- 50000
#Match 5 white balls and 0 Red
w_5_r_0 <- c(5,0)
powerball_numbers <- function(x) {ifelse(x = w_5_r_1, grand_prize)
ifelse(x = w_5_r_0, second_prize)
}
powerball_numbers(5,1)
Error in powerball_numbers(5, 1) : unused argument (1)
Aucun commentaire:
Enregistrer un commentaire