I am new to R, and am trying to use aRpsDCA to create a function to estimate decline parameters for an oil or gas well by history-matching. I get it to work fine on a single well, but am having difficulties applying the formula to a large .csv file containing several wells (The dataset has a well identifier, cumulative months, and then rate at that month for all the wells, and they all have differing cumulative months). I am trying to use lapply but so far am having errors.
I won't go through all of the function, but it takes two variables (q, t), or function(q,t). The function is called h2e.fnc. Here is what I am trying to use to get it to run over the entire list, but it's not working.
declAll <- lapply(hynsvl$API, h2e.fnc(hynsvl$q, hynsvl$t))
Error in match.fun(FUN) :
'h2e.fnc(hynsvl$q, hynsvl$t)' is not a function, character or symbol
$API is the well identifier, and then q and t are rate and time inputs into the function.
Any suggestions on how I would properly run this to get the function to calculate for all of the wells individually?