Last answered:

27 Jan 2023

Posted on:

17 Jan 2023

0

Resolved: What am I doing wrong?

May anyone kindly let me know what I am doing wrong here?



experiment <- function(){ coin <- c('tails', 'heads') flip <- sample(coin, 100, replace = T, prob = c(.7, .3)) print(flip)}

2 answers ( 2 marked as helpful)
Instructor
Posted on:

23 Jan 2023

0

HI Saeed,
thanks for reaching out! In your function, you didn't specify that you want the size of your sample to be 100.
So, you need to add size = 100 in your sample function.
Hope this helps!

Best,
365 Eli

Posted on:

27 Jan 2023

0

Hi Saeed,
I don't see anything incorrect with the code's verbiage. Perhaps the only thing you overlooked was the manner in which you wrote the code.

experiment <- function(){
  coin <- c('tails', 'heads')
  flip <- sample(coin, 100, replace = T, prob = c(.7, .3))
  print(flip)
}

Each part of the code must be written on a separate line. They can't all be on the same line.

Hope this helps.
Ramsey

Submit an answer