I want to assign a score to a value based on which bucket it fits in. The number line is split into four buckets: (-Inf, 0], (0, 100], (100, 1000], (1000, Inf). The buckets are scored 1 through 4.
Here's the code I wrote using if/else, but it seems like R would have something to do this kind of task.
if (min.coverage > 1000) {
on.score <- 4
}
else if (min.coverage > 100) {
on.score <- 3
}
else if (min.coverage > 0) {
on.score <- 2
}
else {
on.score <- 1
}
Update
Thanks to MrFlick for pointing me to the question on how to cut by defined intervals. It covers most of what I asked, but not how to assign a different score to each interval.