I have a dataframe like this:
date value
2020-08-10 1
2020-08-11 1
2020-08-12 3
2020-08-13 3
2020-08-14 5
2020-08-15 5
And I´m using the table function to create a cross table like this:
table(test$date,test$value)
1 3 5
2020-08-10 1 0 0
2020-08-11 1 0 0
2020-08-12 0 1 0
2020-08-13 0 1 0
2020-08-14 0 0 1
2020-08-15 0 0 1
But I´d also like to have columns for values 2 and 4 in my table. Is it possible?
Thanks in advance!