struc_saveSimData: Saving simulation data

Description Usage Arguments Details Value See Also Examples

View source: R/struc_saveSimData.R

Description

struc_saveSimData collects the data of one simulation cycle and returns an object to start a new simulation cycle.

Usage

1
struc_saveSimData(rep_counter, simcycle, start_names, end_names, simstruc)

Arguments

rep_counter

number of the current repetition. integer.

simcycle

number of the current simulation cycle. integer.

start_names

names of the columns with the first population stage in the simulation. character.

end_names

names of the columns with the last population stage in the simulation. These are taken as the first stage in the next simulation cycle. character.

simstruc

two numbers, the first defines the number of repetitions for the simulation, the second defines the number of simulation cycles in each repetition of the simulation. numeric vector with length 2.

Details

In the first simulation cycle the object sim_result of the class prosper is created and the first cycle results are saved. This object is the same for all cycles in all repetitions and gets all the results. The function can only be called once per simulation run.

Value

A prosper object. SimData as a data.table with the repetition in the first and the simulation cycle in the second column.

See Also

struc_endSim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
struc_preparation2(Rmx=10, af=c(2,1), epis=0, dom=c(1,0.3))
dfgenotype$"SB_autumn" <- c(4,23,0,123,53,98,45,3245,234)
dfgenotype$"SB_autumn_end" <- c(0,2,0,123,434,5234,5678,123,2)
#creation of an example object with data of the first year
struc_saveSimData(rep_counter=1, simcycle=1, simstruc=c(5, 10), 
                                 start_names="SB_autumn", end_names="SB_autumn_end")
#creating some fictional population stages
dfgenotype$"SB_autumn" <- c(1,1,1,1,0,0,0,0,4)
dfgenotype$"SB_autumn_end" <- c(67,67,67,67,67,67,67,67,67)
#appending rows with the new results to the first results. necessary columns are inserted.
struc_saveSimData( rep_counter=1, simcycle=2,
                     start_names="SB_autumn", end_names="SB_autumn_end",
                      simstruc=c(repetitions, duration)) 
sim_result                               
rm(sim_result, dfgenotype, mf, xprobab)                               

PROSPER documentation built on July 2, 2020, 3:25 a.m.