require(stacomiR)
stacomi(
database_expected=FALSE)
# If you have a working database
# the following line of code will create the r_seaa dataset
# from the logrami schema in the database
if (FALSE) {
stacomi(database_expected=TRUE, sch='logrami')
# overrides the default option sch = 'iav'
# prompt for user and password, you can set these in the options,
# including dbname and host
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
)
#create an instance of the class
r_seaa<-new("report_sea_age")
r_seaa<-choice_c(r_seaa,
dc=c(107,108,101),
horodatedebut="2012-01-01",
horodatefin="2012-12-31",
limit1hm=675,
limit2hm=875,
silent=FALSE
)
r_seaa<-connect(r_seaa)
r_seaa<-calcule(r_seaa)
}
# load the dataset generated by previous lines
# Salmons from the loire on two dams
data("r_seaa")
# the calculation will fill the slot calcdata
# stages are in r_seaa@calcdata[["6"]][,"stage"]
#look at data structure using str(r_seaa@calcdata[["6"]])
# plot data to confirm the split by limits is correct
plot(r_seaa, plot.type=1)
# if there are several dc, data it split by dc
plot(r_seaa, plot.type=2)
if (FALSE) {
# print a summary statistic, and save the output in a list for later use
stats<-summary(r_seaa)
write_database(r_seaa)
}
Run the code above in your browser using DataLab