Replicate: Replicate a module multiple times

Description Usage Arguments Value Examples

View source: R/Replicate.R

Description

This function is useful when running simulations and could be used with modules that have random number generation internally meaning that results from identical runs are different. Replicate gives the same result as using list() and repeating the module multiple times.

Usage

1

Arguments

call

A module call, e.g. UKAnophelesPlumbeus

n

The number of times to replicate the call

Value

A list of calls

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# run a workflow, using the logistic regression model
## Not run: 

Without Replicate
work1 <- workflow(occurrence = list(UKAnophelesPlumbeus,UKAnophelesPlumbeus,UKAnophelesPlumbeus),
               covariate = UKAir,
               process = OneHundredBackground,
               model = LogisticRegression,
               output = SameTimePlaceMap)
# With Replicate
work2 <- workflow(occurrence = Replicate(UKAnophelesPlumbeus, 3),
               covariate = UKAir,
               process = OneHundredBackground,
               model = LogisticRegression,
               output = SameTimePlaceMap)
# The workflows are the same
plot(work1)
plot(work2)

# Output plots show the random placement of background points
# in each run
work1 <- workflow(occurrence = UKAnophelesPlumbeus,
                 covariate = UKAir,
                 process = Replicate(Background(n=10), n = 10),
                 model = LogisticRegression,
                 output = PrintMap)


## End(Not run)

zoon documentation built on Jan. 23, 2018, 5:21 p.m.