TDASample: Use an alphanumeric string as the seed to generate a random...

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Use this function to generate a reproducible random sample. Random samples are usually made reproducible by setting a numeric seed with set.seed. This function does some transformations to a given alphanumeric string before compting a seed and drawing a sample based on that seed.

Usage

1
  TDASample(inString, N, n)

Arguments

inString

The alphanumeric string that you want to use for generating your seed

N

The total population you are sampling from

n

The number of samples you need

Value

Returns a list with the class TDASample to handle the formatting of the output. The list items include:

Note

The inString argument is not case-sensitive, but it is "space-sensitive". That is to say, inString = "Ananda Mahto" will result in the same seed as inString = "ananda mahto", but a different seed from inString = "anandamahto" or inString = " Ananda Mahto " (note the extra spaces before and after the names).

For a more robust conversion from alphanumeric strings to seeds before sampling, the stringseed.sampling function from the "mrdwabmisc" package is recommended.

Author(s)

Ananda Mahto

See Also

sample, set.seed, stringseed.sampling

Examples

1
2
3
4
5
6
7
8
TDASample(inString = "Ananda Mahto", N = 100, n = 20)

## Should have given a seed of 142190
## Lets verify the sample manually
set.seed(142190)
sample(100, 20)

TDASample("Some crazy! Text string with 123 numbers () in it$", 100, 20)

mrdwab/TDAtools documentation built on May 23, 2019, 7:15 a.m.