##
working, but bad, solution

```
set.seed(seed = 38914)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(purrr)
library(tibble)
library(tidyr)
fake_dataset <- data.frame(a = sample(x = c(1:10, NA),
size = 20,
replace = TRUE),
b = sample(x = c(letters[1:10], NA),
size = 20,
replace = TRUE),
c = sample(x = c((-10):(-1), NA),
size = 20,
replace = TRUE),
d = sample(x = c(letters[17:26], NA),
size = 20,
replace = TRUE),
e = sample(x = c((-5):5, NA),
size = 20,
replace = TRUE),
f = sample(x = c(letters[5:14], NA),
size = 20,
replace = TRUE),
g = sample(x = c((-10):(-1), NA),
size = 20,
replace = TRUE),
h = sample(x = c(letters[13:22], NA),
size = 20,
replace = TRUE),
i = sample(x = c(1:10, NA),
size = 20,
replace = TRUE),
j = sample(x = c(letters[9:18], NA),
size = 20,
replace = TRUE))
fake_dataset %>%
mutate(temp = pmap(.l = select_if(.tbl = .,
.predicate = is.numeric),
.f = list),
temp = map(.x = temp,
.f = ~ sort(x = unlist(x = .x),
decreasing = TRUE,
na.last = TRUE)[1:3]),
temp = map(.x = temp,
.f = enframe)) %>%
unnest_wider(col = temp,
names_sep = "_") %>%
unnest_wider(col = temp_name,
names_sep = "_") %>%
unnest_wider(col = temp_value,
names_sep = "_") %>%
rename(top_1_from = temp_name_...1,
top_2_from = temp_name_...2,
top_3_from = temp_name_...3,
top_1 = temp_value_...1,
top_2 = temp_value_...2,
top_3 = temp_value_...3)
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> New names:
#> * `` -> ...1
#> * `` -> ...2
#> * `` -> ...3
#> # A tibble: 20 x 16
#> a b c d e f g h i j top_1_from
#> <int> <fct> <int> <fct> <int> <fct> <int> <fct> <int> <fct> <chr>
#> 1 4 h -9 s 5 m NA t 6 o i
#> 2 10 h -2 y 4 f -3 v 3 j a
#> 3 4 g -9 t -4 m -4 p 9 p i
#> 4 10 f -10 v -4 h -2 v 8 j a
#> 5 7 j NA s NA n -6 v 6 p a
#> 6 9 a -5 w -5 m -10 p NA o a
#> 7 NA g -8 y NA j -2 o 4 i i
#> 8 8 i -3 v -2 h -6 s 6 i a
#> 9 5 f -10 y 0 <NA> -2 u 6 j i
#> 10 2 d -4 y 2 j -9 u 7 n i
#> 11 4 d NA z NA g -1 u 9 r i
#> 12 9 a -4 z -1 j -8 <NA> 3 q a
#> 13 5 h -1 w 1 h -3 <NA> 10 k i
#> 14 4 i -9 w 5 n -8 v 9 <NA> i
#> 15 3 j -2 <NA> 0 h NA p 3 k a
#> 16 7 c -7 q NA k NA v 9 r i
#> 17 2 e -2 w 0 l -2 n NA <NA> a
#> 18 10 e NA t 0 l -6 o NA l a
#> 19 7 c -10 v NA h -3 q 4 i a
#> 20 2 a -7 t 1 l -8 s NA r a
#> # … with 5 more variables: top_2_from <chr>, top_3_from <chr>,
#> # top_1 <int>, top_2 <int>, top_3 <int>
```

^{Created on 2019-09-05 by the reprex package (v0.3.0)}