randomtourney: Generates a randomized tournament with random outcomes

Description Usage Arguments Value Further details Examples

View source: R/randomtourney.R

Description

Generates a randomized tournament with random outcomes

Usage

1
randomtourney(n, matchups = 2, pties = 0, ints = 100, type = "char")

Arguments

n

Number of individuals in tournament

matchups

Number of times individuals compete in tournament. Can be a numeric input, or, if matchups="random" interactions are random

pties

Probability of each individual matchup ending in a tie. Default is 0, i.e. no ties. Needs to be a number between 0 and 1.

ints

The number of interactions in the tournament if matchups are set to random.

type

Whether to return results as W/L characters or 1/2 numbers. type="char" is the default, type="nums" returns 1/2 numbers referring to winner as id1 or id2

Value

A competition results dataframe

Further details

Specify number of individuals to compete in a tournament and the number of times they compete with each other. Winners and losers are determined at random. The resulting dataframe will have variables: id1, id2, result. Result refers to the outcome from id1's perspective, i.e. a "W" refers to id1 beating id2, and a "L" refers to id2 beating id1. Individuals are referred to by a random assignment of two conjoined letters.

Examples

1
2
3
randomtourney(20,2) #20 individuals interact twice with each other
randomtourney(5,6) #5 individuals interact six times with each other
randomtourney(8) #8 individuals interact twice with each other

compete documentation built on May 29, 2017, 1:39 p.m.