How do I generate a variable that can be called "PV" which will be the difference between the DX values and the DR column values.
For example:
PV of DR0 will be 25-19=6 for 03/01/2021 for Room Super
PV of DR1 will be 25-19=6 for for 03/01/2021 for Room Super
PV of DR2 will be 25-23=2 for for 03/01/2021 for Room Super
And so on.
df <- structure(
      list(date = c("01-01-2021","01-01-2021","01-01-2021","01-01-2021","01-01-2021","02-01-2021","02-01-2021",
"02-01-2021","02-01-2021","02-01-2021","03-01-2021","03-01-2021","03-01-2021","03-01-2021","03-01-2021","04-01-2021",
"04-01-2021","04-01-2021","04-01-2021","04-01-2021"),Room = c("Standard","Master","Luxury","Super","Deluxe","Standard","Master",
"Luxury","Super","Deluxe","Standard","Master","Luxury","Super","Deluxe","Standard","Master","Luxury","Super","Deluxe"),
DX=c(5,8,13,5,3,4,6,18,14,5,9,9,25,25,10,10,9,24,25,12),DR0=c(5,8,13,6,4,4,6,19,14,7,9,7,25,19,12,10,10,30,27,12),
DR1=c(5,8,12,6,3,4,6,19,15,8,9,7,27,19,12,10,8,29,23,12),DR2=c(5,8,12,6,3,4,6,18,15,7,9,7,27,23,16,10,8,31,23,12),
DR3=c(5,8,12,6,3,4,6,18,16,7,9,7,24,19,11,10,8,31,29,14),DR4=c(5,8,12,4,3,4,6,18,16,7,9,7,24,18,11,10,8,28,25,10),
DR5=c(5,8,12,4,3,4,6,18,15,7,9,7,24,18,11,10,8,28,23,10)),class = "data.frame", row.names = c(NA, -20L))
> df
         date     Room DX DR0 DR1 DR2 DR3 DR4 DR5
1  01-01-2021 Standard  5   5   5   5   5   5   5
2  01-01-2021   Master  8   8   8   8   8   8   8
3  01-01-2021   Luxury 13  13  12  12  12  12  12
4  01-01-2021    Super  5   6   6   6   6   4   4
5  01-01-2021   Deluxe  3   4   3   3   3   3   3
6  02-01-2021 Standard  4   4   4   4   4   4   4
7  02-01-2021   Master  6   6   6   6   6   6   6
8  02-01-2021   Luxury 18  19  19  18  18  18  18
9  02-01-2021    Super 14  14  15  15  16  16  15
10 02-01-2021   Deluxe  5   7   8   7   7   7   7
11 03-01-2021 Standard  9   9   9   9   9   9   9
12 03-01-2021   Master  9   7   7   7   7   7   7
13 03-01-2021   Luxury 25  25  27  27  24  24  24
14 03-01-2021    Super 25  19  19  23  19  18  18
15 03-01-2021   Deluxe 10  12  12  16  11  11  11
16 04-01-2021 Standard 10  10  10  10  10  10  10
17 04-01-2021   Master  9  10   8   8   8   8   8
18 04-01-2021   Luxury 24  30  29  31  31  28  28
19 04-01-2021    Super 25  27  23  23  29  25  23
20 04-01-2021   Deluxe 12  12  12  12  14  10  10
 
    