[Stacomir-commits] r457 - in pkg/stacomir: . R man/figures
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 31 19:46:35 CEST 2017
Author: briand
Date: 2017-08-31 19:46:34 +0200 (Thu, 31 Aug 2017)
New Revision: 457
Added:
pkg/stacomir/man/figures/README-rmmmult-1.png
pkg/stacomir/man/figures/README-silver-1.png
Modified:
pkg/stacomir/R/report_sea_age.R
pkg/stacomir/R/stacomi.R
pkg/stacomir/README.Rmd
pkg/stacomir/README.md
pkg/stacomir/man/figures/README-rmmstandard-1.png
Log:
Adding Silver eel example to README.Rmd
Modified: pkg/stacomir/R/report_sea_age.R
===================================================================
--- pkg/stacomir/R/report_sea_age.R 2017-08-31 14:41:16 UTC (rev 456)
+++ pkg/stacomir/R/report_sea_age.R 2017-08-31 17:46:34 UTC (rev 457)
@@ -234,7 +234,7 @@
#r_seaa<-r_sample_char
r_seaa<-object
if(nrow(r_seaa at data)==0) {
- funout(gettext("you are in deep shit",domain="R-stacomiR"), arret=TRUE)
+ funout(gettext("you have no line in the database for this period",domain="R-stacomiR"), arret=TRUE)
}
adm=r_seaa at data # we get the data.frame
# the age already present in the database don't interest us there
Modified: pkg/stacomir/R/stacomi.R
===================================================================
--- pkg/stacomir/R/stacomi.R 2017-08-31 14:41:16 UTC (rev 456)
+++ pkg/stacomir/R/stacomi.R 2017-08-31 17:46:34 UTC (rev 457)
@@ -276,7 +276,7 @@
#' through the command line.}
#' }
#' When \code{database_expected=FALSE} a connection to the database is not expected. Therefore test are run by calling examples object stored in Rdata.
-#'
+#' To change the language use Sys.setenv(LANG = "fr") or Sys.setenv(LANG = "en")
#' @param gr_interface Boolean, if \code{TRUE} the program will launch the graphical interface
#' @param login_window Boolean, if \code{TRUE} a login window will be displayed asking the user to specify
#' user name.
@@ -354,6 +354,7 @@
#' }
#' #launch stacomi without connection to the database
#' stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+#'
#' @export
stacomi=function(gr_interface=TRUE,login_window=TRUE,database_expected=TRUE){
# first loading of connection and odbc info using chargexml()
Modified: pkg/stacomir/README.Rmd
===================================================================
--- pkg/stacomir/README.Rmd 2017-08-31 14:41:16 UTC (rev 456)
+++ pkg/stacomir/README.Rmd 2017-08-31 17:46:34 UTC (rev 457)
@@ -42,7 +42,8 @@
R-Forge.
```{r , eval=FALSE}
-install.packages("stacomiR", repos="http://R-Forge.R-project.org")
+install.packages("stacomiR") # get the package from CRAN
+install.packages("stacomiR", repos="http://R-Forge.R-project.org") # get the development version
```
Usage
@@ -108,7 +109,7 @@
to monitor fish migration. It can be :
* a video counting device,
* a trap,
-* an acoustic counting device,
+* an accoustic counting device,
* ...
@@ -146,19 +147,33 @@
* starting date The date of beginning
* ending date The last date of the report
***
+Read the help files e.g. `? report_mig` to get documentation on the following
+classes.
-| Class | Report type | description|
-| ------------- |:----------| ---------------------------------: |
-|report_mig | Annual migration | Annual migration report |
-| report_mig_mult| Annual migration| Annual migration (several DC, taxa...) |
+| Class | Command | description|
+| ------------- |:----------|:--------------------------------------- |
+|report_mig | `new("report_mig")` | Migration report (single) |
+| report_mig_mult| `new("report_mig_mult")`| Migr. (several DC,taxa...) |
+| report_annual| `new("report_annual")`| Multi year migration counts |
+| report_dc | `new("report_dc")`| Counting device operation |
+| report_df | `new("report_df")`| Fishway operation |
+| report_mig_env | `new("report_env")`| Migration crossed with env. factors |
+| report_mig_char | `new("report_df")`| Migration with fish characteristics |
+|report_mig_interannual | `new("report_mig_interannual")`| Comp. between years|
+|report_sample_char | `new("report_sample_char")`| Sample characteristics |
+|report_ge_weight | `new("report_ge_weight")`| Trend in glass eel weight |
+|report_silver_eel | `new("report_siver_eel")`| Silver eel migration & stage|
+|report_sea_age | `new("report_sea_age")`| Set sea age for Salmon |
+|report_species | `new("report_species")`| Species composition |
-
Working examples
-------------------------
### Command line
+#### Migration report
+
Examples are provided with each of the class, you can access them simply by
typing `? report_mig_mult`
The program is intented to be used in conjuntion with the database, to test it
@@ -231,7 +246,7 @@
```{r rmmstd,eval=FALSE,echo=FALSE,fig.keep="last"}
# chunk not evaluated as it produces 5 plot with dev.new() called in a loop
-Sys.setlocale("LC_ALL","English")
+Sys.setenv(LANG = "fr")
plot(r_mig_mult,plot.type="standard",silent=TRUE)
```
@@ -243,11 +258,40 @@
plot(r_mig_mult,plot.type="multiple",silent=TRUE)
```
+#### Silver eels
+This section provides a short example for the function
+calculating Durif's stages. Those maturity stages for silver eels are
+calculated from body characteristics. The dataset `coef_durif`
+corresponds to classification scores are calculated by multiplying the metrics
+BL = body length, W = weight, MD = mean eye diameter (Dv+Dh)/2, and FL length of
+the pectoral fin, with each parameter p as S=Constant+BL*p(bl)+W*p(W)... The
+function `fun_stage_durif` choose the stage achieving the highest
+score ([Durif et al.,
+2009](http://fishlarvae.org/common/SiteMedia/durif%20et%20al%202009b.pdf))
-
+```{r silver,eval=TRUE,echo=TRUE,fig.keep="all"}
+require(stacomiR)
+data("coef_durif")
+# load a dataset of class report_silver_eel with data slot already prepared
+# here is an example of output
+data("r_silver")
+r_silver <- calcule(r_silver)
+plot(r_silver, plot.type=3)
+#######################################
+# To use the function fun_stage_durif manually
+# create a matrix with columns BL","W","Dv","Dh","FL"
+#############################################
+# here it is extracted from the data at hand
+silver_eel<-as.matrix(r_silver at calcdata[[1]][,c("BL","W","Dv","Dh","FL")])
+head(silver_eel) # to see the first lines
+stage <- fun_stage_durif(silver_eel) # apply the function to the matrix
+stage[1:10] # look at the first 10 elements in vector silver
+```
### R-GTK2 graphical interface
+The program is intended to be used by 'non experienced' R users. Launching
+`stacomi()` will create the interface.
License
-------
Modified: pkg/stacomir/README.md
===================================================================
--- pkg/stacomir/README.md 2017-08-31 14:41:16 UTC (rev 456)
+++ pkg/stacomir/README.md 2017-08-31 17:46:34 UTC (rev 457)
@@ -34,7 +34,8 @@
```r
-install.packages("stacomiR", repos="http://R-Forge.R-project.org")
+install.packages("stacomiR") # get the package from CRAN
+install.packages("stacomiR", repos="http://R-Forge.R-project.org") # get the development version
```
Usage
@@ -57,19 +58,12 @@
Data structure
-------------------
-<<<<<<< .mine
The open source postgresql database comprises a common schema with dictionaries,
and different schema for different users. Each user can save its own schema and
send it to others. *Contact the authors to get a copy of the database*. The
database comprises tables related to infrastructure, operations and fish
samples.
-||||||| .r454
-The open source postgresql database was built on the following concepts.
*Contact the authors to get a copy of the database*.
-=======
-The open source postgresql database was built on the following concepts.
-*Contact the authors to get a copy of the structure of the database*.
->>>>>>> .r455
### Infrastructure
@@ -109,43 +103,10 @@
to monitor fish migration. It can be :
* a video counting device,
* a trap,
-* an acoustic counting device,
+* an accoustic counting device,
* ...
-<<<<<<< .mine
-||||||| .r454
-#### Environmental monitoring station
-=======
-#### Operating periods of the devices
-Both counting and crossing devices are monitored to have clear indications of
-operating periods. These informations are really important to better interpret
-fish migration data.
-
-#### Environmental monitoring station
->>>>>>> .r455
-To better understand migration of fish the database allow to insert information
-about environmental condition at a fish monitoring station. Different
-environmental parameters are available like :
-* turbidity,
-* atmospheric pressure,
-* temperature (both of the river and of the air),
-* flow,
-* lunar cycle,
-* etc.
-<<<<<<< .mine
-||||||| .r454
-
-### Migration
-Whatever infrastructure is all fishes passing through a counting device are
-monitored.
-
-=======
-### Migration
-Whatever infrastructure is all fishes passing through a counting device are
-monitored.
-
->>>>>>> .r455
#### Monitoring operation
An operation corresponds to a monitoring of a counting device during a time
span.
@@ -157,22 +118,12 @@
maturation stage and is related to migratory behaviour) is recorded.
#### Other features
-<<<<<<< .mine
The database also handles, marking-recapture operations, pathologies, samples
collection (scale, fin sample for genetic...), fate of fishes (released, death,
farmed, etc.), etc...
Some tables are also used to insert information
about environmental condition such as turbidity, atmospheric pressure,
temperature, flow ...
-||||||| .r454
-=======
-For each fish passing the counting device features like size, weight, sex, age,
-etc. can be monitored as well as :
-* the futur of the fish (released, death, farmed, etc.),
-* tagging (2 possibilities : read of existing tag or lay of new tag),
-* pathologies,
-* genetic samples.
->>>>>>> .r455
Package structure
@@ -190,19 +141,33 @@
* starting date The date of beginning
* ending date The last date of the report
***
+Read the help files e.g. `? report_mig` to get documentation on the following
+classes.
-| Class | Report type | description|
-| ------------- |:----------| ---------------------------------: |
-|report_mig | Annual migration | Annual migration report |
-| report_mig_mult| Annual migration| Annual migration (several DC, taxa...) |
+| Class | Command | description|
+| ------------- |:----------|:--------------------------------------- |
+|report_mig | `new("report_mig")` | Migration report (single) |
+| report_mig_mult| `new("report_mig_mult")`| Migr. (several DC,taxa...) |
+| report_annual| `new("report_annual")`| Multi year migration counts |
+| report_dc | `new("report_dc")`| Counting device operation |
+| report_df | `new("report_df")`| Fishway operation |
+| report_mig_env | `new("report_env")`| Migration crossed with env. factors |
+| report_mig_char | `new("report_df")`| Migration with fish characteristics |
+|report_mig_interannual | `new("report_mig_interannual")`| Comp. between years|
+|report_sample_char | `new("report_sample_char")`| Sample characteristics |
+|report_ge_weight | `new("report_ge_weight")`| Trend in glass eel weight |
+|report_silver_eel | `new("report_siver_eel")`| Silver eel migration & stage|
+|report_sea_age | `new("report_sea_age")`| Set sea age for Salmon |
+|report_species | `new("report_species")`| Species composition |
-
Working examples
-------------------------
### Command line
+#### Migration report
+
Examples are provided with each of the class, you can access them simply by
typing `? report_mig_mult`
The program is intented to be used in conjuntion with the database, to test it
@@ -221,7 +186,7 @@
at the Arzal dam in the
Vilaine river (France).
We are evaluating the migration
-of all stages of eel (glass eel CIV, yellow eel AGJ and silver eel AGJ).
+of all stages of eel (glass eel CIV, yellow eel AGJ and silver eel AGG).
Glass
eel and yellow eel migrate to the watershed while silver eel
are migrating back
@@ -284,11 +249,56 @@
![plot of chunk rmmmult](man/figures/README-rmmmult-1.png)
+#### Silver eels
+This section provides a short example for the function
+calculating Durif's stages. Those maturity stages for silver eels are
+calculated from body characteristics. The dataset `coef_durif`
+corresponds to classification scores are calculated by multiplying the metrics
+BL = body length, W = weight, MD = mean eye diameter (Dv+Dh)/2, and FL length of
+the pectoral fin, with each parameter p as S=Constant+BL*p(bl)+W*p(W)... The
+function `fun_stage_durif` choose the stage achieving the highest
+score ([Durif et al.,
+2009](http://fishlarvae.org/common/SiteMedia/durif%20et%20al%202009b.pdf))
+```r
+require(stacomiR)
+data("coef_durif")
+# load a dataset of class report_silver_eel with data slot already prepared
+# here is an example of output
+data("r_silver")
+r_silver <- calcule(r_silver)
+plot(r_silver, plot.type=3)
+#> Warning in predict.lm(rlmmodb, newdata = newdata, se.fit = TRUE, type = "response", : Assuming constant prediction variance even though model fit is weighted
+```
+
+![plot of chunk silver](man/figures/README-silver-1.png)
+
+```r
+#######################################
+# To use the function fun_stage_durif manually
+# create a matrix with columns BL","W","Dv","Dh","FL"
+#############################################
+# here it is extracted from the data at hand
+silver_eel<-as.matrix(r_silver at calcdata[[1]][,c("BL","W","Dv","Dh","FL")])
+head(silver_eel) # to see the first lines
+#> BL W Dv Dh FL
+#> 25710 830 1074 8.14 8.70 39.79
+#> 25711 714 740 8.24 8.52 38.04
+#> 25712 720 755 6.92 6.87 34.01
+#> 25713 860 1101 10.53 10.43 44.47
+#> 25714 716 752 7.42 8.76 33.78
+#> 25715 690 622 7.83 9.25 29.58
+stage <- fun_stage_durif(silver_eel) # apply the function to the matrix
+stage[1:10] # look at the first 10 elements in vector silver
+#> 25710 25711 25712 25713 25714 25715 25716 25717 25718 25719
+#> "FIII" "FIII" "FIII" "FIV" "FIII" "FIII" "FV" "FV" "FIII" "FIII"
+```
### R-GTK2 graphical interface
+The program is intended to be used by 'non experienced' R users. Launching
+`stacomi()` will create the interface.
License
-------
Added: pkg/stacomir/man/figures/README-rmmmult-1.png
===================================================================
(Binary files differ)
Property changes on: pkg/stacomir/man/figures/README-rmmmult-1.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: pkg/stacomir/man/figures/README-rmmstandard-1.png
===================================================================
(Binary files differ)
Added: pkg/stacomir/man/figures/README-silver-1.png
===================================================================
(Binary files differ)
Property changes on: pkg/stacomir/man/figures/README-silver-1.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
More information about the Stacomir-commits
mailing list