I'm interested in making a tibble
that represents all of the gifts in the 12 days of Christmas. For those unfamiliar with the song, each day in the song includes a new gift, and all of the previous day's gifts (similar to purrr::accumulate
)
For example, the first day just has 1 Partridge in a Pear Tree; the second day has 2 Turtle Doves and 1 Partridge in a Pear Tree; the third day has 3 French Hens, 2 Turtle Doves, 1 Partridge in a Pear Tree; ..., and so forth.
On the final twelfth day of Christmas has:
- 12 Drummers Drumming
- 11 Pipers Piping
- 10 Lords a Leaping
- 9 Ladies Dancing
- 8 Maids a Milking
- 7 Swans a Swimming
- 6 Geese a Laying
- 5 Golden Rings
- 4 Calling Birds
- 3 French Hens
- 2 Turtle Doves
- and a Partridge in a Pear Tree
I am wondering what the most "elegant" way to populate a tibble
of the 12 days of Christmas is.
If day 1 is:
tibble(partridge = 1,
doves = 0,
hens = 0,
birds = 0,
rings = 0,
geese = 0,
swans = 0,
maids = 0,
ladies = 0,
lords = 0,
pipers = 0,
drummers = 0)
and day 12 is:
tibble(partridge = 1,
doves = 2,
hens = 3,
birds = 4,
rings = 5,
geese = 6,
swans = 7,
maids = 8,
ladies = 9,
lords = 10,
pipers = 11,
drummers = 12)
What's a clever way to make a tibble
that has all 12 days?