crossover: Cross two chromosomes

Description Usage Arguments Value Examples

Description

Simulates a random genetic crossover event between 2 binary chromosomes

Usage

1
crossover(p0, p1)

Arguments

p0

First chromosome

p1

Second chromosome

Value

Returns a child string in which a section of p0 has been replaced by the corresponding section in p1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Example 1
p0 <- '0000000'
p1 <- '1111111'
crossover(p0, p1)
[1] "0001110" #<--This corresponds to a crossover occuring from the 4th through 6th loci

## Example 2
p0 <- '0101'
p1 <- '00001101010'
crossover(p0, p1)
Error: L0 == L1 is not TRUE

tjmassaro/ssga documentation built on May 6, 2019, 7:33 a.m.