[R] Need some help
azza.khogaliali at utoronto.ca
Mon Oct 15 16:33:13 CEST 2007
Quite helpful indeed. Greatly appreciated.
Another problem I had was trying to simulate an example from my book.
Simulating 1000 coin tosses, and finding the frequency of sign changes. So
how will we plot this using R? (frequency of sign changes in Y axis)
Daniel Nordlund wrote:
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> On Behalf
>> Of azzza
>> Sent: Sunday, October 14, 2007 10:21 PM
>> To: r-help at r-project.org
>> Subject: [R] Need some help
>> 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
>> I put in >randu, and just copy-paste the first 20 numbers?? Or is there,
>> I suspect, a better way of calling out exactly 20 uniform random
> 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
>> will have today.
> see ?sample
>> number_of_purchases <- sum(sample(c(0,1), 200, prob=c(.70, .30),
> Hope this is helpful,
> Daniel Nordlund
> Bothell, WA USA
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/Need-some-help-tf4624513.html#a13214128
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help