COMBINE AND TRANSFORME DATAFRAME

Solution for COMBINE AND TRANSFORME DATAFRAME
is Given Below:

I have a dataframe(df) that looks like below:
enter image description here
Objective: I want to create this dataframe, I don’t know how to use it with dplyr

enter image description here