flr / FLa4a

The repository for the JRC initiative on stock assessment
https://fishreg.jrc.ec.europa.eu/web/a4a
12 stars 6 forks source link

Converting from length to age based data (Doubt) #94

Closed esanchezll closed 8 years ago

esanchezll commented 8 years ago

Hello all,

I'm trying to convert from length to age based data (using the l2a method).

I'm new in this kind of analysis, so I am following the a4a draft manual, 2004 to reach my objective.

The problem it's that the program returns me an error...

"Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘l2a’ for signature ‘"FLIndices", "

...when I have to convert my FLIndex.

It is the code of this part:

vbTriSmall <- mvrtriangle(10, vbObj, paramMargins=triPars) cth.n <- l2a(catch.n(HKE.stk), vbTriSmall)

aStk <- l2a(cth.n, vbTriSmall) aIdx <- l2a(HKE.idx, vbTriSmall,10) `#Error in (function (classes, fdef, mtable) :

unable to find an inherited method for function ‘l2a’ for signature ‘"FLIndices", "a4aGr"`

Do you know where is the error?

Thank you in advance,

King regards

Eduardo

iagomosqueira commented 8 years ago

la2 is defined for a single FLIndex

> showMethods('l2a')
Function: l2a (package FLa4a)
object="FLIndex", model="a4aGr"
object="FLQuant", model="a4aGr"
object="FLStockLen", model="a4aGr"

so try calling it on each element, or use lapply, as in (untested)

lapply(HKE.idx, l2a, vbTriSmall, n=10)
esanchezll commented 8 years ago

Everything solved with lapply!

Thanks a lot @iagomosqueira !