Error: x must be atomic for ‘sort.list’

From the output of str(cc2), the variable inside of the data.table, V1, is itself a list. This means that cc2 is a nested list of length 1. The error is occurring because table calls sort.list, which requires an atomic vector as input.

Try using unlist:

cc3 <- as.data.frame(table(unlist(cc2)))

unlist will (recursively) extract elements from their list containers. So unlist(cc2) will return a vector, which works directly with table.

Leave a Comment