Skip to content
Prev 248107 / 398503 Next

select a subset from a sample

I think there are multiple solutions that match your criteria. Here is one:

dat <- structure(list(Id = 1:20, v1 = c(1L, 2L, 4L, 1L, 3L, 3L, 3L,
+ 4L, 1L, 4L, 2L, 1L, 2L, 4L, 3L, 2L, 1L, 2L, 4L, 3L), v2 = c(2L,
+ 1L, 2L, 1L, 2L, 1L, 4L, 4L, 2L, 1L, 4L, 4L, 3L, 3L, 2L, 3L, 4L,
+ 3L, 1L, 3L), v3 = c(4L, 3L, 4L, 2L, 3L, 1L, 3L, 4L, 2L, 1L, 3L,
+ 2L, 3L, 1L, 1L, 2L, 1L, 4L, 4L, 2L), v4 = c(3L, 4L, 2L, 3L, 4L,
+ 1L, 1L, 4L, 1L, 2L, NA, 3L, 4L, NA, 2L, 3L, 4L, 3L, 1L, 1L)), .Names
= c("Id",
+ "v1", "v2", "v3", "v4"), class = "data.frame", row.names = c(NA,
+ -20L))
Best,
Ista
On Sun, Jan 23, 2011 at 12:43 PM, Wei Yang <peterwyang1 at gmail.com> wrote: