First, just get a random order.
> k <- sample(nrow(players))
Then, to get the names in each command, put the list in that order and put it in two columns.
> matrix(players$V1[k], ncol=2)
## [,1] [,2]
## [1,] "keith" "charlie"
## [2,] "paul" "john"
## [3,] "ron" "brian"
## [4,] "mick" "george"
## [5,] "ozzy" "ringo"
To get the total, do the same with the estimates and calculate the sums of the columns.
> colSums(matrix(players$V2[k], ncol=2))
#
Aaron source
share