[FLR-list] plot stock - unit SSB

Clara Ulrich clu at aqua.dtu.dk
Mon Dec 11 10:10:04 CET 2017


Thank you Iago. I have changed all units as in ple4 and it worked.  I hadn’t noticed this before.

Clara

From: flr-list-bounces at lists.r-forge.r-project.org [mailto:flr-list-bounces at lists.r-forge.r-project.org] On Behalf Of Iago Mosqueira
Sent: 8. december 2017 22:14
To: flr-list <flr-list at flr-project.org>
Subject: Re: [FLR-list] plot stock - unit SSB

Hi,

The units in the panels in ggplotFL were added quite some time ago. Take a quick look at the units in your slots with

summary(stock)

try changing those 'thousands' in stock.n for '1000' or '1e3', and see where that NA comes from. Maybe m.spwn or harvest.spwn, which should have units="". With those, ssb() comes with units='t', as when you do

units(FLQuant(units='1000') * FLQuant(units='kg'))

ssb is the result of a method, not a slot, so there is not units to be changed. Rather it is generated from the slots used in the calculation.

Also, if the units in stock are meant to be the same as ple4 (1000 for the *.n slots, kg for *.wt, "" for mat, m.spwn and harvest.spwn, "f" for harvest) you can do

units(stock)  <- units(ple4)

Let me know how it goes. Cheers,


Iago


---- On Fri, 08 Dec 2017 17:45:33 +0400 Clara Ulrich <clu at aqua.dtu.dk<mailto:clu at aqua.dtu.dk>> wrote ----

Hi all,

Brief question, it seems to me that the default stock plot in ggplotFL has changed in the most recent FLCore update, with the units now appearing on the panel title. This fails for the SSB panel on my stocks, because of the units:

> ssb(stock)
An object of class "FLQuant"
, , unit = unique, season = all, area = unique
     year
age   2012   2013   2014   2015   2016
  all 605787 694432 809921 770556 836066

units:  1 * thousands 1 *  1 * kg 1 * NA

> units(ssb(stock))
[1] "1 * thousands" "1 * "          "1 * kg"        "1 * NA"
> units(ssb(ple4))
[1] "t"

How does this work for ple4, to force the unit of the ssb function, as it is not a slot?
Thanks
Clara



_______________________________________________
flr-list mailing list
flr-list at flr-project.org<mailto:flr-list at flr-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/flr-list/attachments/20171211/cf37e81b/attachment.html>


More information about the flr-list mailing list