[R] Games

Michael Bedward michael.bedward at gmail.com
Fri Aug 13 15:10:29 CEST 2010


Nice question Silvano !

teams <- LETTERS[1:11]
matches <- combn(teams, 2)
draw <- data.frame(team1=matches[1,], team2=matches[2,],
round=sequence(10:1) + rep(0:9, times=10:1))

Is there a prize :-)

Michael

On 13 August 2010 21:30, Silvano <silvano at uel.br> wrote:
> Hi,
>
> I want to build the table of a football league with 11 teams. All play
> together. So will 55 games.
> Since there are an odd number of teams in each round a team will not play.
> The games will be:
>
> games = urnsamples(1:11, x = c('A','B','C','D','E','F','G','H','I','J','K'),
> size=2, replace=F,
> ordered=FALSE)
> games
>
> As will be five games per round. How to build a table with all the
> championship rounds, automatically?
> I thought about something like:
>
> game1 = c(
> sample(11,2)
> sample(11,2)
> sample(11,2)
> sample(11,2)
> sample(11,2)
> )
>
> but, isn't work very well.
>
> Some suggestion?
>
> --------------------------------------
> Silvano Cesar da Costa
> Departamento de Estatística
> Universidade Estadual de Londrina
> Fone: 3371-4346
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list