# buildPattern: Build a pattern In conjurer: A Parametric Method for Generating Synthetic Data

 buildPattern R Documentation

## Build a pattern

### Description

Builds data based on a pattern. This function uses another internal function genPattern.

### Usage

buildPattern(n, parts, probs)

### Arguments

 n A natural number. This specifies the number of data points to build. parts A natural number. This specifies the parts that make up the pattern. probs A number between 0 and 1.

### Details

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 steps in the process of building data from a pattern is as follows.

1. Identify the parts that make up the data. Ideally, these parts have a pattern and a probabilistic distribution of their own. For example, a phone number has three parts namely, country code, area code and a number.

2. Assign probabilities to each of the above parts. If a part contains only one member, then the corresponding probability must be 1. However, if there are multiple members in the part, then each member must have a probability provided in the respective order.

A vector.

genPattern.

### Examples

parts <- list(c("+91","+44","+64"), c(491,324,211), c(7821:8324))
probs <- list(c(0.25,0.25,0.50), c(0.30,0.60,0.10), c())
phoneNumbers <- buildPattern(n=20,parts = parts, probs = probs)