I hope you guys are doing well.
I have a quick question. Here is my code:
for(i in 2:49){
PriceFun[i] = approxfun(data[i]$FUEL_PRICE_REAL ~ data[i]$dd)
PriceFromDate[i] = function(x) {
round(PriceFun[i](x), 3) }
}
What I want the output to be:
PriceFun2 = approxfun(data2$FUEL_PRICE_REAL ~ data2$dd)
PriceFromDate2 = function(x) {
round(PriceFun2(x), 3) }
PriceFun3 = approxfun(data3$FUEL_PRICE_REAL ~ data3$dd)
PriceFromDate3 = function(x) {
round(PriceFun3(x), 3) }
and so on...
Is my syntax incorrect? I rarely use R
Thanks in advance.