Given a list, I seek to create a new list with duplicate list entries removed but also wish to store the multiplicity of each unique list entry.
For example, in the following list, I would like to obtain a list of three elements: character(0), “11”, “33” “44” and their corresponding multiplicities of 2, 2 and 1, respectively:
> list
[[1]]
character(0)
[[2]]
"11"
[[3]]
"11"
[[4]]
character(0)
[[5]]
"33" "44"
You can use
uniqueto get the unique entries andtablewithmatchto get the frequencies: