[R] randomly select duplicated entries

Juliet Hannah juliet.hannah at gmail.com
Wed Jul 9 21:17:42 CEST 2008


Using this data as an example

dat <- read.table(textConnection("Id         myvar
12 1
12 2
12 6
34 9
34 4
34 8
65 15
65 23"), header = TRUE)
closeAllConnections()

how can I create another data set that does not have duplicate entries
for 'Id', but the included values
are randomly selected from the available ones.

Thanks!

Juliet



More information about the R-help mailing list