Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Should be done in RStudio 3. Read in the file deck.csv, which we will use to simulate drawing cards from a deck. (check the demonstration

Should be done in RStudio

3. Read in the file deck.csv, which we will use to simulate drawing cards from a deck.

(check the demonstration sample code below for a related example)

(a) Simulate drawing two cards (without replacement) 5 times and print out the hand each

time.

(b) Simulate drawing a hand of two cards 100,000 times to estimate the probability of

drawing a pair (two cards with the same face).

(c) Simulate drawing a hand of five cards (without replacement) 100,000 times to estimate

the probability of drawing a flush (all suits are the same)

(Hint: use length(unique(hand $ suit)) to measure the number of different suits in hand)

Sample Code

deck = read.csv("deck.csv")

reps =3

numPairs = 0

for(i in 1:reps){

index = sample(1:52,size=5,replace = FALSE)

hand = deck[index,]

print(hand)

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

7-16 Compare Web 2.0 and Web 3.0.

Answered: 1 week ago