Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dt %>%
- arrange(label) %>%
- group_by(label) %>%
- mutate(total = n(),
- percent = sum(match == 1) /total)
- # A tibble: 10 x 6
- # Groups: label [6]
- id label predicted match total percent
- <dbl> <dbl> <dbl> <dbl> <int> <dbl>
- 1 3 1 1 1 3 0.667
- 2 8 1 1 1 3 0.667
- 3 10 1 4 0 3 0.667
- 4 6 2 2 1 1 1
- 5 7 3 3 1 1 1
- 6 5 4 2 0 1 0
- 7 2 5 5 1 2 0.5
- 8 4 5 3 0 2 0.5
- 9 1 6 6 1 2 0.5
- 10 9 6 4 0 2 0.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement