> -----Original Message-----
> From:
r-help-bounces@... [mailto:
r-help-bounces@...] On Behalf
> Of azzza
> Sent: Sunday, October 14, 2007 10:21 PM
> To:
r-help@...
> Subject: [R] Need some help
>
>
> Hi!
> I'm taking a course that requires some programming background, but I'm a
> complete novice in the field.
>
> when asked to generate a list of 20 uniform random numbers, is it alright if
> I put in >randu, and just copy-paste the first 20 numbers?? Or is there, as
> I suspect, a better way of calling out exactly 20 uniform random numbers??
>
See ?runif
rand_nums <- runif(20)
> I'm also unable to solve the following problem:
> We know that on average 30% of the customers who enter a store make a
> purchase. Suppose 200
> people enter the store today. Run a simulation to see how many purchases we
> will have today.
>
see ?sample
> number_of_purchases <- sum(sample(c(0,1), 200, prob=c(.70, .30), replace=TRUE))
Hope this is helpful,
Dan
Daniel Nordlund
Bothell, WA USA
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.