Question: The question involves a dice rolling experiment using R. One fair die is rolled 10 times. I am trying to write a function that returns

The question involves a dice rolling experiment using R. One fair die is rolled 10 times.

I am trying to write a function that returns true if the number of even numbers observed in this experiment is greater than 5.

The first part of my function returns a random sample of 10 numbers for the die rolling and it works when using return(dice), but I am getting stuck after that to instead return true for observing more than 5 even numbers.

Here is what I have so far:

trial <- function(){

dice <- sample(1:6, size = 10, replace = True)

??}

Where I have the ??, what should I put next? I tried using a for loop and I couldn't get it to work. Is there another way to do it? Or what should the syntax be for the loop?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!