I've a large data.table which looks like
custid, dayofweek, revenue
AA 2 345
AA 3 545
BB 1 544
BB 4 456
CC 7 231
I would like to "grow" this data table such that it has all 7 numbers for each custid with the revenue column set to NA
. Example shown below.
custid, dayofweek, revenue
AA 1 NA
AA 2 345
AA 3 545
AA 4 NA
AA 5 NA
AA 6 NA
AA 7 NA
BB 1 544
BB 2 NA
BB 3 NA
BB 4 456
BB 5 NA
BB 6 NA
BB 7 NA
CC 1 NA
CC 2 NA
CC 3 NA
CC 4 NA
CC 5 NA
CC 6 NA
CC 7 231
Growing it that way is definitely not a join operation. Any help appreciated. Thanks in advance.