| To: | Wei Ye <weiye1@yahoo.com> |
|---|---|
| Subject: | Re: random partitioning of a data frame |
| From: | Tim Hesterberg <timh@insightful.com> |
| Date: | Fri, 18 Jan 2008 16:53:19 -0800 |
| Cc: | s-news@lists.biostat.wustl.edu |
| In-reply-to: | <797046.11300.qm@web51811.mail.re2.yahoo.com> (message from Wei Ye on Fri, 18 Jan 2008 16:42:02 -0800 (PST)) |
| References: | <797046.11300.qm@web51811.mail.re2.yahoo.com> |
Try this: indices <- sample(1:nrow(x), 100,replace=F) x[indices, ] x[-indices, ] Tim Hesterberg >Dear S-news members: > >I am new to S-plus programing.I would really >appreciate it if somebody can help me with this. > >I took a random sample from a large data frame x >using: >samp1<-x[sample(1:nrow(x), 100,replace=F),]. >But I also want to keep the observations that were not >selected. How do I separate the observations that were >sampled and those that were not sampled? Thanks a lot. > >Wei |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | random partitioning of a data frame, Wei Ye |
|---|---|
| Next by Date: | Problem with matrix, Tristan Lorino |
| Previous by Thread: | random partitioning of a data frame, Wei Ye |
| Next by Thread: | Problem with matrix, Tristan Lorino |
| Indexes: | [Date] [Thread] [Top] [All Lists] |