data.table equivalent of tidyr::complete()

I reckon that the philosophy of data.table entails fewer specially-named functions for tasks than you’ll find in the tidyverse, so some extra coding is required, like: res = setDT(df)[ CJ(person = person, observation_id = observation_id, unique=TRUE), on=.(person, observation_id) ] After this, you still have to manually handle the filling of values for missing levels. We … Read more