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<ml-node%2b2289092-1912443153-77...@n4.nabble.com>
> wrote:

>       id pID50      apol     a_acc    a_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  3.14  0.183448 -0.527967 -0.298197  0.873019      0  0.290021
> 5 mol.29  2.77 -0.273901 -0.527967 -0.298197  0.110860      0 -0.193347
> 6 mol.30  2.74 -0.230593 -0.527967 -0.298197  0.110860      0  0.000000
> 7 mol.40  2.16 -1.117550 -0.527967 -0.298197 -1.032380      0 -1.256760
> 8 mol.45  1.90 -0.383560 -0.527967 -0.298197  0.110860      0 -0.290021
> 9 mol.48  1.73 -0.383560 -0.527967 -0.298197  0.110860      0 -0.290021
>
>
> What if I want to exclude 2 columns?
> For example:   sample(data, 3, replace=FALSE)     ##from my sample, i want
> to exclude *both *id and pID50
>
> Thanks much.
>
> ------------------------------
>  View message @
> http://r.789695.n4.nabble.com/Want-to-exclude-a-column-when-using-sample-function-tp2287988p2289092.html
> To unsubscribe from Re: Want to exclude a column when using sample
> function, click here< (link removed) ==>.
>
>
>

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Want-to-exclude-a-column-when-using-sample-function-tp2287988p2289173.html
Sent from the R help mailing list archive at Nabble.com.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to