Re: [R] Odp: Sampling problem

2010-11-18 Thread wangwallace
I tried. yours works too. thanks a bounch!! Man -- View this message in context: http://r.789695.n4.nabble.com/Sampling-problem-tp3043804p3049013.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https:

Re: [R] Odp: Sampling problem

2010-11-16 Thread wangwallace
I figured it out myself. Again, Michael and Petr, many thanks to both of you!!! :) -- View this message in context: http://r.789695.n4.nabble.com/Sampling-problem-tp3043804p3046161.html Sent from the R help mailing list archive at Nabble.com. __ R-h

Re: [R] Odp: Sampling problem

2010-11-16 Thread Dennis Murphy
Hi: Try this: # Function to generate one sample from the data frame sampler <- function(df) { s1 <- sample(nrow(df), 1, replace = FALSE) s2 <- sample(setdiff(1:nrow(df), s1), 2, replace = FALSE) list(sample1 = df[s1, grep('^C', names(df))], sample2 = df[s2, grep('^W', nam

Re: [R] Odp: Sampling problem

2010-11-16 Thread wangwallace
Fabulicious! It worked!!! One more question, in the following data frame as posted above: SubIDCSE1 CSE2 CSE3 CSE4 WSE1 WSE2 WSE3 WSE4 1 6 5 6 2 6 22 4 2 6 4 7 2 6 6

[R] Odp: Sampling problem

2010-11-16 Thread Petr PIKAL
Hi Here is one way (If I understood what you did ask). test<-read.table("clipboard", header=T) > test SubID CSE1 CSE2 CSE3 CSE4 WSE1 WSE2 WSE3 WSE4 1 165626224 2 264726623 3 355555545 4