Learn R Programming

stacomiR (version 0.6.1)

report_mig-class: Migration report for one DC, one species and one stage

Description

This class performs a migration summary. A migration monitoring operation can correspond to a single horodate (in the case of some video monitoring operation) or comprise a period which does not necessarily span a full day. The daily migration is calculated by splitting the operation between days, and the migration is either grouped or split according to the lenth of the different time spans.

Arguments

Slots

dc

Object of class ref_dc-class: the control device

taxa

Object of class ref_taxa-class: the species

stage

Object of class ref_stage-class : the stage of the fish

timestep

Object of class ref_timestep_daily-class : the time step constrained to daily value and 365 days

data

Object of class data.frame with data filled in from 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

Object of class POSIXct : a time sequence of days generated by the calcule method

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_char-class, report_mig_env-class, report_mig_interannual-class, report_mig_mult-class, report_sample_char-class, report_sea_age-class, report_silver_eel-class, report_species-class

Examples

Run this code
stacomi(database_expected=FALSE) 
# If you have a working database
# the following line of code will create the r_mig dataset from the iav (default) 
# schema in the database
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.user = password						
	)	
  stacomi(
	  database_expected=TRUE)	
  r_mig=new("report_mig")
  r_mig=choice_c(r_mig,
	  dc=5,
	  taxa=c("Chelon ramada"),
	  stage=c("IND"),
	  datedebut="2015-01-01",
	  datefin="2015-12-31")
  r_mig<-charge(r_mig)
  # launching charge will also load classes associated with the report
  # e.g. report_ope, report_df, report_dc
  r_mig<-connect(r_mig)
  ########################
# calculations
  ########################
  r_mig<-calcule(r_mig,silent=TRUE)
}
########################
# loading data
## 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
# All three classes report... were created by the charge and connect method 
# of report_mig_mult
# in the previous example
################################
data("r_mig")
data("r_mig_ope")
assign("report_ope",r_mig_ope,envir=envir_stacomi)
data("r_mig_df")
assign("report_df",r_mig_df,envir=envir_stacomi)
data("r_mig_dc")
assign("report_dc",r_mig_dc,envir=envir_stacomi)


#Individual plot for all DC (standard), taxa and stage where data present
#silent argument to stop all messages
plot(r_mig,plot.type="standard",silent=TRUE)
#cumulated migration at the station (all stages and DC grouped)
plot(r_mig,plot.type="step")

# data will be written in the data directory specified in datawd argument to stacomi default "~"
#file

if (FALSE) {
  summary(r_mig,silent=TRUE)
}
# this will write the daily report for later in in the reportnMigrationInterannuelle-class
if (FALSE) {
  write_database(r_mig,silent=TRUE,dbname="bd_contmig_nat",host="localhost",port=5432)
}

Run the code above in your browser using DataLab