In R, I am producing a document containing random parts addressed to a list of persons.
However, I would like that the same document, addressed to the same person but generated several times, returns always the same number.
For instance I sample a team number (A or B) and I would like any version of the document for person P to mention, say, A.
I know of set.seed
function but this require an integer where I have strings (persons' names). So, is there a clever way to map a string to an integer in my case? Or an other (simpler) solution for generating random documents?