Hi

I have written a simulation using simecol and for portability to other
computers, I would like to put it into a package.

The structure is as follow:

I have a main file which I source, which initialises everything, creates the
simecol object and adds the equations, via sourcing further files.

After the sourcing of the main file is completed, I then have an object
called ASM which I then use (manually) to do the simulations.

So my ain file looks effectively as follow:

#########################
library(simecol)                        # provides framework for simulation
library(sp)                             # work with spatial data (sp)
library(maptools)

setClass(
         "alienSpreadModel",
         representation(
                        init = "SpatialGridDataFrame",
                        Debug = "logical"
                        ),
         contains = "simObj"
         )

ASM <- new(
           "alienSpreadModel",
           main   = function() {},
           equations = list(),
           parms  = NULL,
           solver = "iteration",
           Debug = Debug
           )

source("./spreadSim.layersIO.R")            # add input output routines to
equations(ASM)
source("./spreadSim.calcStats.R")           # add routines to calculate
summary stats to equations(ASM)
.
.
.

parms(ASM)$inputDir <- "./../data/input/"
parms(ASM)$outputDir <- "./../data/output/"
#########################

So what I would like to have is that after loading the package, is either an
object ASM which I can use, or, probably even better, a function
makeASM()which, when called, creates the object ASM.

But I am stuck - I know how to create packages containing R functions, but
somehow can not get my head around how to do it with a simecol object.

Any help appreciated,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

	[[alternative HTML version deleted]]

