powered by
Compacting a vector of any length with or without names
compact_vec(data, nm.sep = ": ", val.sep = "; ")
character string
vector, optionally named
string separating name from value if any
string separating values
sample(seq_len(4), 20, TRUE) |> as_factor() |> named_levels() |> sort() |> compact_vec() 1:6 |> compact_vec() "test" |> compact_vec() sample(letters[1:9], 20, TRUE) |> compact_vec()
Run the code above in your browser using DataLab