I am attempting to add new rows to a data frame with column values that are calculated by using other data from different locations on the same date within my data frame (if possible). A simplified example of my data frame is provided below (I basically have monthly data for seven stations over 10 years, monthly flows (SAC, YOLO, ect) are constant each month and the same for every station). I want to add monthly data for new stations that are calculated using regression equations from the other stations. For example my new rows would include:
Station = C9
Month = same as D19 & D28 data
Year = same as D19 & D28 data
DissAmmonia = 0.43 * D19(DissAmmonia) + 0.03
DisssNitrateNitrate = 0.76 * D28A(DisssNitrateNitrate) + 0.13
TN = 0.73 *D28A(TN) + 0.30
SAC = same for month, year
YOLO = same for month, year
NMassBalance:
Station Month Year DissAmmonia DissNitrateNitrite TN SAC YOLO ...
C3A 10 2009 0.5 0.25 0.2 1000 2000
C10A 10 2009 0.4 0.28 0.1 1000 2000
MD10A 10 2009 0.5 0.25 0.2 1000 2000
D28A 10 2009 0.4 0.28 0.1 1000 2000
D19 10 2009 0.5 0.25 0.2 1000 2000
D4 10 2009 0.4 0.28 0.1 1000 2000
D26 10 2009 0.5 0.25 0.2 1000 2000
C3A 11 2009 0.4 0.28 0.1 1500 800
C10A 11 2009 0.5 0.25 0.2 1500 800
MD10A 11 2009 0.4 0.28 0.1 1500 800
D28A 11 2009 0.5 0.25 0.2 1500 800
D19 11 2009 0.4 0.28 0.1 1500 800
D4 11 2009 0.5 0.25 0.2 1500 800
D26 11 2009 0.4 0.28 0.1 1500 800
. . .
. . .
. . .
I am attempting to write some kind of if statement or filter that generates a row for each month of each year with other representative station data.