I have a large data frame consisting off several stations, concentration of different parameters, and flow. I am attempting to write GAMs specific to certain station for one concentration parameter and I am having trouble singling out specific elements in my code. In this case I would like to write a regression for TP concentration at Station C9 as a function of TP concentrations at stations D19 and D28A and flows from SWP.
Sample Data Frame:
Hist_P_Dataset
Station, Year, Month, Day, Ortho Phosphate, TP, SAC, YOLO, SWP
C9, 1975, 1, 1, 0.67, 0.25, 2265,1285,1026
D19, 1975, 1, 1, 0.7, 0.5, 2265,1285,1026
D28A, 1975, 1, 1, 0.67, 0.25, 2265,1285,1026
D24, 1975, 1, 1, 0.7, 0.5, 2265,1285,1026
D16, 1975, 1, 1, 0.67, 0.25, 2265,1285,1026
.
.
Sample Code:
C9_TP <- gam(TP.C9 ~ s(D19.TP)+s(D28A.TP)+s(SWP), data=Hist_P_Dataset, method="REML")
Error in eval(predvars, data, env) : object 'TP.C9' not found
I am pretty new to R, so any help is greatly appreciated!