We can do this with dcast from data.table which can take multiple value.var columns
library(data.table)
dcast(setDT(df), Area ~ year, value.var = c("P", "N"))
# Area P_2017 P_2018 N_2017 N_2018
#1: 1 5 1 5 1
#2: 2 6 2 6 2
#3: 3 7 3 7 3
#4: 4 NA 4 NA 4