[FLR-list] incompatible units of measurements in FLQuant objects: f + NA

Iago MOSQUEIRA (JRC) iago.mosqueira at jrc.ec.europa.eu
Mon Jan 26 13:22:22 CET 2015


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



More information about the flr-list mailing list