Re: [R] sample function

From: David Scott <d.scott_at_auckland.ac.nz>
Date: Fri 11 Mar 2005 - 14:13:01 EST

On Thu, 10 Mar 2005, mirage sell wrote:

> Hi everyone, I need help.
> I want to have a "uniform" kind distribution. When I used sample function I
> got almost twice many zeros compared to other numbers. What's wrong with my
> command ?
>

Nothing is wrong with your sampling, it is the display in the histogram.

Try
temp <-sample(0:12, 2000, replace=T,prob=(rep(1/13,13))) table(temp)

David Scott


David Scott	Department of Statistics, Tamaki Campus
 		The University of Auckland, PB 92019
 		Auckland	NEW ZEALAND
Phone: +64 9 373 7599 ext 86830		Fax: +64 9 373 7000
Email:	d.scott@auckland.ac.nz


Graduate Officer, Department of Statistics



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Mar 11 14:22:22 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:42 EST