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

Iago Mosqueira iago.mosqueira at gmail.com
Fri Jan 23 16:20:19 CET 2015


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
> 



More information about the flr-list mailing list