Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Real Analysis

Authors: N L Carothers

1st Edition

1139632434, 9781139632430

More Books

Students also viewed these Mathematics questions

Question

Go, do not wait until I come

Answered: 1 week ago

Question

Make eye contact when talking and listening

Answered: 1 week ago

Question

Do not go, wait until I come

Answered: 1 week ago