A variety of base solutions: > mydf$rnd mydf avar bvar rnd 1 A 1 C 2 B 1 B 3 C 1 5 4 4 1 4 5 5 1 A 6 6 2 7 7 7 2 9 8 8 2 6 9 9 2 10 10 10 2 8 > aggregate(mydf$avar, mydf"bvar", FUN=sample) bvar x.1 x.2 x.3 x.4 x.5 1 1 4 C 5 B A 2 2 7 9 10 8 6 > by(mydf$avar, mydf"bvar", FUN=sample) mydf"bvar": 1 1 C B 5 4 A Levels: 10 4 5 6 7 8 9 A B C ----------------------------------------------------------- mydf"bvar": 2 1 9 8 6 10 7 Levels: 10 4 5 6 7 8 9 A B C.
Try this: > daply(mydf, .(bvar), sample) $`1` avar bvar 1 A 1 2 B 1 3 C 1 4 4 1 5 5 1 $`2` avar bvar 6 6 2 7 7 2 8 8 2 9 9 2 10 10 2 or > daply(mydf, .(bvar), summarize, ans = sample(avar)) $`1` ans 1 A 2 C 3 4 4 B 5 5 $`2` ans 1 10 2 9 3 7 4 8 5 6.
Thanks, the first has a problem as it appears not randomizing , but the second is OK – John Nov 11 at 1:33 ah, yes. The first one randomizes the order of column... – kohske Nov 11 at 1:54 You probably want ddply(mydf, .(bvar), summarize, ans = sample(avar)) – hadley Nov 11 at 17:59.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.