I have a dataset as shown below. I'd like to know how to rearrange the dataset so that the hours are sorted into two new columns - One for 'Day' and one for 'Night.
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.
Also note that if your column names are capitalized, you must make "Period" and "Hours" capitalized as well in your pivor_wider() call.
The first two lines in the code @nirgrahamuk provided are an example data set. Take a look at the tidyr vignette on transforming data (Pivoting • tidyr).