@@ -287,19 +287,26 @@ colonies. Although we are not sampling drones directly, you still need to
287
287
provide ` nDrones ` argument to determine the number of sampled drone producing
288
288
colonies.
289
289
290
- For spatial mating, we need to set the location to our apiaries (all the
291
- colonies within an beekeeper will have the same location). Here, we are setting
292
- this locations randomly, but these could be actual coordinated of colonies
293
- within a country .
290
+ For spatial mating, we need to set the location to our apiaries. Here, we are
291
+ reading the locations in from a file with the coordinates of all colonies, then
292
+ selecting the colonies of a specific beekeeper, creating a list of coordinate
293
+ pairs (with the ` Map ` function). We could also set locations randomly .
294
294
295
295
``` {r}
296
+ # Read locations from a file
297
+ locations = read.csv("Colony_locations.csv")
296
298
# Set location to apiaries
299
+ beekeeper1_locations <- locations[locations$ColonyID %in% getId(beekeeper1),]
297
300
beekeeper1 <- setLocation(beekeeper1,
298
- location = Map(c, runif(nColonies(beekeeper1), 0, 2*pi), runif(nColonies(beekeeper1), 0, 2*pi)))
301
+ location = Map(c, beekeeper1_locations$X, beekeeper1_locations$Y))
302
+
303
+ beekeeper2_locations <- locations[locations$ColonyID %in% getId(beekeeper2),]
299
304
beekeeper2 <- setLocation(beekeeper2,
300
- location = Map(c, runif(nColonies(beekeeper2), 0, 2*pi), runif(nColonies(beekeeper2), 0, 2*pi)))
305
+ location = Map(c, beekeeper2_locations$X, beekeeper2_locations$Y))
306
+
307
+ beekeeper3_locations <- locations[locations$ColonyID %in% getId(beekeeper3),]
301
308
beekeeper3 <- setLocation(beekeeper3,
302
- location = Map(c, runif(nColonies(beekeeper2), 0, 2*pi), runif(nColonies(beekeeper3), 0, 2*pi) ))
309
+ location = Map(c, beekeeper3_locations$X, beekeeper3_locations$Y ))
303
310
304
311
```
305
312
@@ -372,10 +379,13 @@ beekeepers 1 to 3 as drone producing colonies. Let's first set the locations of
372
379
the beekeepers 4 and 5 colonies.
373
380
374
381
``` {r}
382
+ beekeeper4_locations <- locations[locations$ColonyID %in% getId(beekeeper4),]
375
383
beekeeper4 <- setLocation(beekeeper4,
376
- location = Map(c, runif(nColonies(beekeeper4), 0, 2*pi), runif(nColonies(beekeeper4), 0, 2*pi)))
384
+ location = Map(c, beekeeper4_locations$X, beekeeper4_locations$Y))
385
+
386
+ beekeeper5_locations <- locations[locations$ColonyID %in% getId(beekeeper5),]
377
387
beekeeper5 <- setLocation(beekeeper5,
378
- location = Map(c, runif(nColonies(beekeeper5), 0, 2*pi), runif(nColonies(beekeeper5), 0, 2*pi) ))
388
+ location = Map(c, beekeeper5_locations$X, beekeeper5_locations$Y ))
379
389
```
380
390
381
391
Now, we will mate the colonies of beekeeper 4 in a random manner and colonies of
0 commit comments