[FLR-list] plot stock - unit SSB

Iago.MOSQUEIRA at ec.europa.eu Iago.MOSQUEIRA at ec.europa.eu
Mon Dec 11 10:16:32 CET 2017


Great.

I think it is worth the efffort of setting the units right, specially now that certain operations give you back the right converted units.

There is a short tutorial on this at

http://www.flr-project.org/doc/Units_of_measurement_in_FLR_objects.html

Cheers,


Iago


--
Dr Iago Mosqueira

European Commission
DG Joint Research Centre
Directorate D - Sustainable Resources
Unit D.02 Water and Marine Resources

TP 051, Via Enrico Fermi 2749
I-21027 Ispra (VA), Italy

Phone : +39 0332 785413

iago.mosqueira at ec.europa.eu
________________________________
From: flr-list-bounces at lists.r-forge.r-project.org [flr-list-bounces at lists.r-forge.r-project.org] on behalf of Clara Ulrich [clu at aqua.dtu.dk]
Sent: 11 December 2017 10:10
To: flr-list at flr-project.org
Subject: Re: [FLR-list] plot stock - unit SSB

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/792eca16/attachment-0001.html>


More information about the flr-list mailing list