generate_single_region: Generate single region

Description Usage Arguments Examples

View source: R/generate_sequence.R

Description

Generate a region using an alphabet of unigrams and considering provided set of rules.

Usage

1
generate_single_region(alphabet, reg_len, prop_ranges, exactness)

Arguments

alphabet

the unigram alphabet. Columns are equivalent to unigrams and rows to particular properties.

reg_len

the number of unigrams inside the region.

prop_ranges

required intervals of properties of unigrams in the region. See Details.

exactness

a numeric value between 0 and 1 defining how stricly unigrams are kept within prop_ranges. If 1, only unigrams within prop_ranges are inside the region. if 0.9, there is 10 unigrams that are not in the prop_ranges will be inside the region.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
props1 <- list(P1 = c(0, 0.5), 
               P2 = c(0.2, 0.4),
               P3 = c(0.5, 1),
               P4 = c(0, 0))

props2 <- list(P1 = c(0.5, 1), 
               P2 = c(0.4, 1),
               P3 = c(0, 0.5),
               P4 = c(1, 1))


alph <- generate_unigrams(c(replicate(8, props1, simplify = FALSE),
                            replicate(12, props2, simplify = FALSE)),
                          unigram_names = letters[1L:20])

rules1 <- list(P1 = c(0.5, 1), 
               P2 = c(0.4, 1),
               P3 = c(0, 0.5),
               P4 = c(1, 1))

generate_single_region(alph, 10, rules1, 0.9)

biogram documentation built on March 31, 2020, 5:14 p.m.