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)}
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
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