Hi! I appreciate your effort, but it is not reproducible. We don't have access to data
. Please check out the following FAQ.
I've tried to generate a fake dataset and have a solution, which I don't like myself, but I hope that will give others a chance to share their solutions.
set.seed(seed = 42079)
some_letters <- sample(x = letters[1:5],
size = 25,
replace = TRUE)
some_groups <- sample.int(n = 10,
size = 25,
replace = TRUE)
column_of_interest <- split(x = some_letters,
f = some_groups)
some_other_column <- sample.int(n = 10)
fake_dataset <- as.data.frame(x = cbind(some_other_column,
column_of_interest))
within(data = fake_dataset,
expr =
{
modified_column <- lapply(X = column_of_interest,
FUN = sort)
})
#> some_other_column column_of_interest modified_column
#> 1 3 d d
#> 2 1 e, c c, e
#> 3 9 a, e, c a, c, e
#> 4 7 c c
#> 5 4 a, c a, c
#> 6 10 e, a, a, d, b a, a, b, d, e
#> 7 8 d, a, b a, b, d
#> 8 5 c, d c, d
#> 9 6 d, e, b b, d, e
#> 10 2 e, d, d d, d, e
Created on 2019-10-12 by the reprex package (v0.3.0)