genPattern | R Documentation |

Generates data based on a pattern. This function is used by another internal function `buildPattern`

.

genPattern(orderedList)

`orderedList` |
A list of lists. The element |

This function helps in generating data based on a pattern. To explain in simple terms, this function aims to perform the exact opposite of a regular expression i.e regex function. In other words, this function generates data given a generic pattern.
The input is a list of components that make up the pattern. Each component i.e element of the list is a also list with two vectors namely *values* and *probs*. The vector *values* has the set of values out of which one of them is selected randomly. If this random selection is supposed to be completely random, then the next vector *probs* can be left empty i.e. NULL. However, if the random selection of values is expected to follow a a pre-determined probabilistic distribution, then the probabilities must be provided explicitly. To explain further, if there are three values *a*, *b*, *c* and their probabilistic distribution must be 25 percent, 50 percent and 25 percent respectively, then the vector *values* will take the form *c(a,b,c)* and the vector *probs* will take the form *c(0.25,0.5,0.25)*.

A character vector.

[buildPattern()]

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.