[FLR-list] incompatible units of measurements in FLQuant objects: f + NA
Iago MOSQUEIRA (JRC)
iago.mosqueira at jrc.ec.europa.eu
Mon Jan 26 14:46:42 CET 2015
Hi,
That message in the call to max comes from calling it with an empty vector
> max()
[1] -Inf
Warning message:
In max() : no non-missing arguments to max; returning -Inf
so something inside SRplot is passing an empty vector, called ssb, to max.
You will have to ask the author of the msy package, or try debug(SRplot)
and see if you can see where ssb is calculated/extracted.
Iago
On 26/01/15 14:09, Havstovan FAMRI wrote:
> hey,
>
> "FIT" is a list and it seems that function calls ssb and rec work:
>
>> SRplot(FIT)
> Error in split.default(X, group) : first argument must be a vector
> In addition: Warning messages:
> 1: In max(ssb) : no non-missing arguments to max; returning -Inf
> 2: In max(ssb) : no non-missing arguments to max; returning -Inf
> 3: In max(rec * 1.5) : no non-missing arguments to max; returning -Inf
>
>> class(FIT)
> [1] "list"
>
>> ssb(stock)
> An object of class "FLQuant"
> , , unit = unique, season = all, area = unique
>
> .....
> .....
> age 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008
> 2009 2010 2011 2012
> all 78536 81162 83683 80683 96734 112908 127358 126181 120553 104484
> 92801 67499 54354 55251
>
> units: t
>
>> rec(stock)
>
> ....
> ....
> year
> age 1991 1992 1993 1994 1995 1996 1997 1998
> 1999 2000 2001 2002 2003 2004 2005
> 3 24969.8 19552.4 23778.3 16873.2 38969.7 24308.2 33472.0 12741.5
> 58789.8 35781.1 87950.1 105894.1 64469.1 53818.0 69512.3
> year
> age 2006 2007 2008 2009 2010 2011 2012
> 3 21688.7 18407.1 32493.3 13606.6 27986.9 73259.1 28990.8
>
> Trying to figuring out what function:
>
> FIT <- eqsr_fit(stock,
> + nsamp = 1000,
> + id.sr = "stock",
> + models = c("segreg"),
> + method = "Buckland")
>
> is doing.
>
> Best,
> Luis
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> Luis Ridao Cruz
> Faroe Marine Research Institute
> Nóatún 1, P.O. Box 3051
> FO-110 Tórshavn
> Faroe Islands
> Tel : (+298) 353900
> Fax: : (+298) 353901
> e-mail: luisr at hav.fo
> luridao at gmail.com
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>
>
> On Mon, Jan 26, 2015 at 12:22 PM, Iago MOSQUEIRA (JRC) <
> iago.mosqueira at jrc.ec.europa.eu> wrote:
>
>>
>> Hi,
>>
>> That warning by lattice has nothing to do with the units. It shows up
>> every now and then, I will investigate it further.
>>
>>>> SRplot(FIT)
>>> Error in split.default(X, group) : first argument must be a vector
>>> In addition: Warning messages:
>>> 1: In max(ssb) : no non-missing arguments to max; returning -Inf
>>> 2: In max(ssb) : no non-missing arguments to max; returning -Inf
>>> 3: In max(rec * 1.5) : no non-missing arguments to max; returning -Inf
>>
>> I don't know that package, but my guess is something is not right in the
>> calculation of ssb and rec. Look at ssb(stock). What type f object is FIT?
>>
>> Cheers,
>>
>>
>> Iago
>>
>>
>> On 26/01/15 11:27, Luis Ridao wrote:
>>>
>>> I have changed the FLStock units to ('ple4' units):
>>> $catch
>>> [1] "t"
>>>
>>> $catch.n
>>> [1] "10^3"
>>>
>>> $catch.wt
>>> [1] "kg"
>>>
>>> $discards
>>> [1] "t"
>>>
>>> $discards.n
>>> [1] "10^3"
>>>
>>> $discards.wt
>>> [1] "kg"
>>>
>>> $landings
>>> [1] "t"
>>>
>>> $landings.n
>>> [1] "10^3"
>>>
>>> $landings.wt
>>> [1] "kg"
>>>
>>> $stock
>>> [1] "t"
>>>
>>> $stock.n
>>> [1] "10^3"
>>>
>>> $stock.wt
>>> [1] "kg"
>>>
>>> $m
>>> [1] "m"
>>>
>>> $mat
>>> [1] "NA"
>>>
>>> $harvest
>>> [1] "f"
>>>
>>> $harvest.spwn
>>> [1] "NA"
>>>
>>> $m.spwn
>>> [1] "NA"
>>>
>>> The plot function does the plotting but it stills issues a warning:
>>>
>>>> plot(stock)
>>> Warning message:
>>> In `[<-.factor`(`*tmp*`, ri, value = c(3, 3, 3, 3, 3, 3, 3, 3, 3, :
>>> invalid factor level, NA generated
>>>
>>>
>>> which it might trigger the error when calling the SRplot function
>>> in "msy" package:
>>>
>>>> SRplot(FIT)
>>> Error in split.default(X, group) : first argument must be a vector
>>> In addition: Warning messages:
>>> 1: In max(ssb) : no non-missing arguments to max; returning -Inf
>>> 2: In max(ssb) : no non-missing arguments to max; returning -Inf
>>> 3: In max(rec * 1.5) : no non-missing arguments to max; returning -Inf
>>>
>>> I'm just trying to make sure that the error does not come from the FLR
>>> objects
>>> which "msy" package makes use of.
>>>
>>> Best,
>>> Luis
>>>
>>>
>>> On 01/23/2015 03:20 PM, Iago Mosqueira wrote:
>>>> Hi,
>>>>
>>>> The FLQuant arithmetic tries now to do something about combinations of
>>>> units, but as you saw only issues warnings when it fails. To get it to
>>>> work, you need to use the standard units names, which are
>>>>
>>>> 't' instead of 'tonnes'
>>>>
>>>> '1000' instead of 'thousands'
>>>>
>>>> For example
>>>>
>>>> kg * 1000 = t
>>>>
>>>>> FLQuant(1, units='kg') * FLQuant(10, units='1000')
>>>> An object of class "FLQuant"
>>>> , , unit = unique, season = all, area = unique
>>>>
>>>> year
>>>> quant 1
>>>> all 10
>>>>
>>>> units: t
>>>> The warning has been taken away in recent versions, so try re-installing
>>>> from the repository.
>>>>
>>>> Let us know how it goes.
>>>>
>>>> Best,
>>>>
>>>>
>>>> Iago
>>>>
>>>> On 23/01/15 16:13, Havstovan FAMRI wrote:
>>>>> Hi all,
>>>>>
>>>>> Trying to work with a FLStock object.
>>>>> When doing a basic call like:
>>>>>
>>>>>> plot(stock)
>>>>> Warning messages:
>>>>> 1: In FLCore:::uom(op, units(e1), units(e2)) :
>>>>> incompatible units of measurements in FLQuant objects: f + NA
>>>>> 2: In `[<-.factor`(`*tmp*`, ri, value = c(3, 3, 3, 3, 3, 3, 3, 3, 3, :
>>>>> invalid factor level, NA generated
>>>>>
>>>>> I get the graph but the warning propagates forward to other function
>>>>> calls
>>>>> like
>>>>>
>>>>> eqsr_fit(stock,.....) in packaǵe "msy":
>>>>>
>>>>>> eqsr_fit(stock,
>>>>> + nsamp = 1000,
>>>>> + id.sr = "mystock",
>>>>> + models = c("segreg"),
>>>>> + method = "Buckland")
>>>>>
>>>>> Warning message:
>>>>> In FLCore:::uom(op, units(e1), units(e2)) :
>>>>> incompatible units of measurements in FLQuant objects: f + NA
>>>>>
>>>>> The units in the "stock" object are:
>>>>>
>>>>>> units(stock)
>>>>> $catch
>>>>> [1] "tonnes"
>>>>>
>>>>> $catch.n
>>>>> [1] "thousands"
>>>>>
>>>>> $catch.wt
>>>>> [1] "kg"
>>>>>
>>>>> $discards
>>>>> [1] "tonnes"
>>>>>
>>>>> $discards.n
>>>>> [1] "thousands"
>>>>>
>>>>> $discards.wt
>>>>> [1] "kg"
>>>>>
>>>>> $landings
>>>>> [1] "tonnes"
>>>>>
>>>>> $landings.n
>>>>> [1] "thousands"
>>>>>
>>>>> $landings.wt
>>>>> [1] "kg"
>>>>>
>>>>> $stock
>>>>> [1] "tonnes"
>>>>>
>>>>> $stock.n
>>>>> [1] "NA"
>>>>>
>>>>> $stock.wt
>>>>> [1] "kg"
>>>>>
>>>>> $m
>>>>> [1] "NA"
>>>>>
>>>>> $mat
>>>>> [1] "NA"
>>>>>
>>>>> $harvest
>>>>> [1] "f"
>>>>>
>>>>> $harvest.spwn
>>>>> [1] "NA"
>>>>>
>>>>>
>>>>> I'm using:
>>>>>
>>>>> R version 3.0.2 (2013-09-25)
>>>>> Platform: x86_64-pc-linux-gnu (64-bit) UBUNTU
>>>>>
>>>>> and FLCore version FLCore_2.5.20140213
>>>>>
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>> #######################################################
>>>>> The full sessionInfo() is below:
>>>>> #######################################################
>>>>>
>>>>>> sessionInfo()
>>>>> R version 3.0.2 (2013-09-25)
>>>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>>>>
>>>>> locale:
>>>>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>>>>> LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>>>>> LC_MONETARY=en_US.UTF-8
>>>>> [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
>>>>> LC_ADDRESS=C LC_TELEPHONE=C
>>>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>>>
>>>>> attached base packages:
>>>>> [1] grid stats graphics grDevices utils datasets methods
>>>>> base
>>>>>
>>>>> other attached packages:
>>>>> [1] msy_0.1.12 stringr_0.6.2 R2admb_0.7.10
>>>>> gridExtra_0.9.1 ggplot2_1.0.0 reshape2_1.2.2
>>>>> [7] scam_1.1-8 mgcv_1.7-28 nlme_3.1-113
>>>>> devtools_1.5 FLCore_2.5.20140213 MASS_7.3-29
>>>>> [13] lattice_0.20-29 xtable_1.7-1 plyr_1.8.1
>>>>>
>>>>> loaded via a namespace (and not attached):
>>>>> [1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4
>>>>> evaluate_0.5.5 formatR_0.10 gtable_0.1.2 httr_0.4
>>>>> [8] knitr_1.6 labeling_0.2 Matrix_1.1-2
>>>>> memoise_0.2.1
>>>>> munsell_0.4.2 parallel_3.0.2 proto_0.3-10
>>>>> [15] RColorBrewer_1.0-5 Rcpp_0.11.0 RCurl_1.95-4.3
>>>>> scales_0.2.3
>>>>> splines_3.0.2 stats4_3.0.2 tools_3.0.2
>>>>> [22] whisker_0.3-2
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> flr-list mailing list
>>>>> flr-list at flr-project.org
>>>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>>>>
>>>> _______________________________________________
>>>> flr-list mailing list
>>>> flr-list at flr-project.org
>>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>>
>>> _______________________________________________
>>> flr-list mailing list
>>> flr-list at flr-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>
>>
>> --
>> Dr Iago Mosqueira
>>
>> European Commission – Joint Research Center
>> Institute for the Protection and Security of the Citizen (IPSC)
>> Maritime Affairs Unit G03
>> TP 051, Via Enrico Fermi 2749
>> I-21027 Ispra (VA), Italy
>>
>> Office : +39 0332 785413
>> Fax: +39 0332 789658
>>
>> iago.mosqueira at jrc.ec.europa.eu
>>
>> http://fishreg.jrc.ec.europa.eu/home
>>
>> _______________________________________________
>> flr-list mailing list
>> flr-list at flr-project.org
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>
>
>
>
> _______________________________________________
> flr-list mailing list
> flr-list at flr-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>
--
Dr Iago Mosqueira
European Commission – Joint Research Center
Institute for the Protection and Security of the Citizen (IPSC)
Maritime Affairs Unit G03
TP 051, Via Enrico Fermi 2749
I-21027 Ispra (VA), Italy
Office : +39 0332 785413
Fax: +39 0332 789658
iago.mosqueira at jrc.ec.europa.eu
http://fishreg.jrc.ec.europa.eu/home
More information about the flr-list
mailing list