I would like to create a grouping variable.
If Candy.df$winpercent > 55354046, winner high
if Candy.df$winpercent >= 43078911 & <= 55354046, winner low
This is what I implemented so far:
Candy.df$result2 <- ifelse(Candy.df$winpercent > 55354046 , "winner_high", ifelse >= 43078911 & < 55354046, "winner_low")
My problem is to correctly enter a code for the interval
You should really try to do it yourself first. But here's an example:
x <- sample(1:10, 20, replace = TRUE)
mybreaks <- c(0, 3, 6, 10)
mylabels <- c('no win', 'low win', 'high win')
winstatus <- cut(x, breaks = mybreaks, labels = mylabels)
Just plug in your values for x, mybreaks and mylabels.