Save time when organising a round of coffee roulette chats, in which people who sign up are paired up randomly with each other! The code generates the random pairs for you, and ensures each person appears only once per round.
You can install coffeeroulettepairs like so:
remotes::install_github("moj-analytical-services/coffee_roulette_pairs")
save_pairs
function (see below), giving the path to the csv file containing names to the names_file
argument, and if
required the path to the unwanted pairs csv file to the unwantedpairs_file
argument.This will write a new csv file in the current working directory called randompairs.csv
containing the random pairs of names. It also appends
to an existing, or creates a new two column csv file called unwantedpairs.csv
, containing the pairs which have just been matched,
in addition to any pre-existing unwanted pairs.
You now have a round of random pairs of names, in which every one is matched with some one else, and everyone appears only once!
# Load the package
library(coffeeroulettepairs)
# Run the save_pairs function
save_pairs(names_file = 'path/to/names.csv', unwantedpairs_file = 'path/to/uwp.csv')
If too many unwanted pairs are provided, the code might not find sufficient unique random pairs to match everyone with a partner after making a number of attempts defined by the no_of_tries
parameter (default value = 20), while ensuring no name appears more than once. In this case either:
1. Increase the value of the no_of_tries
parameter, and try running the function again. The code re-randomizes the list of pairs each time it attempts to fill a round, so will have another chance at doing so.
1. Keep running the function, until sufficient pairs have been generated.
1. Remove some unwanted pairs, and run the function again, which makes it more likely to generate a complete round.
no_of_tries
parameter, until enough random pairs are generated such that everyone is matched with some one else.Feedback, comments, suggestions for improvements are always welcome! Please raise an issue or create a pull request.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.