create_sequence {dsmmR} | R Documentation |
Simulate a sequence for states of choice.
Description
This is a wrapper function around sample()
.
Usage
create_sequence(states, len = 5000, probs = NULL, seed = NULL)
Arguments
states |
Character vector of unique values. If given the value "DNA" the values c("a", "c", "g", "t") are given instead. |
len |
Optional. Positive integer with the default value equal to 5000. |
probs |
Optional. Numeric vector with values interpreted as
probabilities for each of the states in |
seed |
Optional. Object specifying the initialization of the random
number generator (see more in |
Value
A character sequence of length len
.
See Also
For the simulation of a sequence with a drifting semi-Markov kernel: simulate.dsmm.
The original function: sample
.
About random number generation in R: RNG
.
For the theoretical background of drifting semi-Markov models: dsmmR.
Examples
# This is equal to having the argument `probs = c(1/4, 1/4, 1/4, 1/4)`.
rand_dna_seq <- create_sequence(states = "DNA")
table(rand_dna_seq)
random_letters <- sample(letters, size = 5, replace = FALSE)
rand_dna_seq2 <- create_sequence(
states = random_letters,
probs = c(0.6, 0.3, 0.05, 0.025, 0.025),
len = 10000)
table(rand_dna_seq2)