Learn R Programming

stacomiR (version 0.6.1)

report_mig_mult-class: Migration reports for multiple DC / species / stages

Description

Migration counts for several Fish counting devices (DC), several taxa and several stages. This migration count can be built either by the graphical interface or from the command line (see examples).

Arguments

Slots

dc

An object of class ref_dc-class

taxa

An object of class ref_taxa-class

stage

An object of class ref_stage-class

timestep

An object of class ref_timestep_daily-class

data

A data.frame containing raw data filled by the connect method

calcdata

A 'list' of calculated daily data, one per dc, filled in by the calcule method

coef_conversion

A data frame of daily weight to number conversion coefficients, filled in by the connect method if any weight are found in the data slot.

time.sequence

A POSIXt time sequence

Author

Cedric Briand cedric.briand@eptb-vilaine.fr

See Also

Other report Objects: report_annual-class, report_dc-class, report_df-class, report_env-class, report_ge_weight-class, report_mig-class, report_mig_char-class, report_mig_env-class, report_mig_interannual-class, report_sample_char-class, report_sea_age-class, report_silver_eel-class, report_species-class

Examples

Run this code
library(stacomiR)

stacomi(database_expected=FALSE) 
## launches the application in the command line
## here an example of loading
## the following lines will only run if you have the program installed
## and the iav scheme available in the database
## this example generates the r_mig_mult dataset
# prompt for user and password but you can set appropriate options for host, port and dbname
if (FALSE) {
  stacomi(
	  database_expected=TRUE)	
if (interactive()){
	if (!exists("user")){
		user <- readline(prompt="Enter user: ")
		password <- readline(prompt="Enter password: ")	
	}	
}
options(					
		stacomiR.dbname = "bd_contmig_nat",
		stacomiR.host ="localhost",
		stacomiR.port = "5432",
		stacomiR.user = user,
		stacomiR.password = password						
)	
  r_mig_mult <- new("report_mig_mult")
  r_mig_mult <- choice_c(r_mig_mult,
	  dc=c(5,6,12),
	  taxa=c("Anguilla anguilla"),
	  stage=c("AGG","AGJ","CIV"),
    datedebut="2011-01-01",
    datefin="2011-12-31")
  r_mig_mult <- charge(r_mig_mult)
  # launching charge will also load classes associated with the report
  # e.g. report_ope, report_df, report_dc
  r_mig_mult <- connect(r_mig_mult)
  # calculations 
  r_mig_mult <- calcule(r_mig_mult,silent=TRUE)
}

# Use this as example if you don't have a connexion to the database
data("r_mig_mult")
# The following re-create the object at the time of loading
# All three classes were created by the charge and connect 
# method of report_mig_mult in the previous example
data("r_mig_mult_ope")
assign("report_ope",r_mig_mult_ope,envir=envir_stacomi)
data("r_mig_mult_df")
assign("report_df",r_mig_mult_df,envir=envir_stacomi)
data("r_mig_mult_dc")
assign("report_dc",r_mig_mult_dc,envir=envir_stacomi)
# use the following to get the raw data loaded by the connect method
# not shown there as the database and program might not be installed

#Individual plot for all DC, taxa and stage where data present



if (FALSE) {	
plot(r_mig_mult,plot.type="standard",silent=TRUE)
# colors in the following order (glass eel)
# working, stopped, 1...5 types of operation,numbers, weight, 2 unused colors
# for yellow eel and other taxa
# stopped, 1...5 types of operation, ponctuel, expert, calcule,mesure,working,
  plot(r_mig_mult,plot.type="standard",
	  color=c("#DEF76B","#B950B5","#9ABDDA","#781A74","#BF9D6E","#FFC26E",
		  "#A66F24","#012746","#6C3E00","#DC7ED8","#8AA123"),
	  color_ope=c("#5589B5","#FFDB6E","#FF996E","#1C4D76"),
	  silent=TRUE)
#For the following plot, beware, all stages and DC are grouped. This can make sense
# for instance if you want to display the cumulated migration for one species
# in several counting devices located on the same dam...
  plot(r_mig_mult,plot.type="step",silent=TRUE)
  
  
# Combined plot for ggplot2
  plot(r_mig_mult,plot.type="multiple",silent=TRUE)
# Data will be written in the data directory specified in 
# the datawd argument to stacomi, default "~"
  summary(r_mig_mult,silent=FALSE)
}

Run the code above in your browser using DataLab