[R] Want to exclude a column when using sample function
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Wed Jul 14 19:41:44 CEST 2010
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" <addiwei at gmail.com> wrote:
>
>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...and I sample 10 from the data
>set using:
>sample10 <- sample(data, 10, replace=FALSE)
>
>##and then from this sample of 10, I'll run my analysis, and then I wish to
>randomly replace 3 samples out of 10, with 3 new factors from the list of
>180 factors (that have not been chosen thus far). I wish to store all the
>factors that have been chosen for analysis into an object to avoid me going
>back and picking those same factors again....
>--
>View this message in context: http://r.789695.n4.nabble.com/Want-to-exclude-a-column-when-using-sample-function-tp2287988p2289118.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help at 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.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list