Thanks for the comment - I tried copying and pasting your code and replaced df with name of my file but it won't work. The data provided here is only a sample, there are in fact 336 observations for Hours if that matters.
DNH(p=rep(c("Day","Night"),3),
h=1:6) %>%
pivot_wider(names_from="Period",
values_from="Hours") %>%
unnest(cols = everything())
Error in DNH(p = rep(c("Day", "Night"), 3), h = 1:6) :
could not find function "DNH"