Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread Addi Wei
Maybe I'm missing something, but after reading the reshape package, I'm still not quite sure how reshaping the data will help me with storing the previously used samples and preventing me from selecting previously used samples in the future. This is my pseudo code thought process, but I'm not s

Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread T.D. Rudolph
sample(data, 3, replace=FALSE)[,-1:2] or sample(data, 3, replace=FALSE)[,-c("id","pID50")] Tyler On Wed, Jul 14, 2010 at 1:17 PM, Addi Wei [via R] < ml-node+2289092-1912443153-77...@n4.nabble.com > wrote: > id pID50 apol a_acca_acid a_aro a_base a_count > 1 mol.11 3.63

Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread Jeff Newmiller
I would use "melt" from the reshape package so that "sample" could be used, rather than trying to process various selections of columns from a wide data.frame. "Addi Wei" wrote: > >Sorry to post multiple questions, but this is still related to the sample >function. > >In my previous example, h

Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread Addi Wei
Sorry to post multiple questions, but this is still related to the sample function. In my previous example, how do I save/store the current sample so when I run sample again (after analysis) I can exclude the samples that were previously chosen. For example if I have 180 factors or columns...an

Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread Joshua Wiley
On Wed, Jul 14, 2010 at 10:24 AM, Federico Andreis wrote: > I guess you could just use as an argument to sample > > data[,-c(1,2)] > > where 1 and 2 are id and pID50 column number or if you do not know them and do not want to find out: sample(data[ , - match(c("id", "x3"), names(data))], 3, repl

Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread Federico Andreis
I guess you could just use as an argument to sample data[,-c(1,2)] where 1 and 2 are id and pID50 column number On Wed, Jul 14, 2010 at 7:17 PM, Addi Wei wrote: > > id pID50 apol a_acca_acid a_aro a_base a_count > 1 mol.11 3.63 -0.882267 -0.527967 -0.298197 -1.032380

Re: [R] Want to exclude a column when using sample function

2010-07-14 Thread Addi Wei
id pID50 apol a_acca_acid a_aro a_base a_count 1 mol.11 3.63 -0.882267 -0.527967 -0.298197 -1.032380 0 -1.063410 2 mol.14 3.38 -1.007330 -0.527967 -0.298197 -1.032380 0 -1.063410 3 mol.19 3.18 1.153560 1.407910 -0.298197 1.254100 0 1.160080 4 mol.20

Re: [R] Want to exclude a column when using sample function

2010-07-13 Thread T.D. Rudolph
It's not really clear what the structure of your data is, nor how exactly you are sampling it (you need to provide an example), but you could try adding this to the end of your sample command (if the result is a data.frame or matrix): [,-1] Tyler -- View this message in context: http://r.789695

[R] Want to exclude a column when using sample function

2010-07-13 Thread Addi Wei
For example: When I take a sample of 5 from 10 columns, I want to exclude from the sample column 1 from being chosen. How do I do this? -- View this message in context: http://r.789695.n4.nabble.com/Want-to-exclude-a-column-when-using-sample-function-tp2287988p2287988.html Sent from the R h