I'm solving a probability problem. The question is to calculate the probability of drawing two face cards (Jack, Queen, King) in a row. Simulate a standard deck of 52 cards (no Jokers). Sample two cards from the deck 1000 times (remember, we do not replace the card after drawing). How does the proportion of times two face cards were drawn compare to the probability you calculated?

I tried this:

``` poker <- c(1:10, "J", "Q", "K")

poker_face <- sample(poker, size = 1000, replace = FALSE)```

I'm getting the following error:

``` Error in sample.int(length(x), size, replace, prob) :    cannot take a
sample larger than the population when 'replace = FALSE'```
May 27, 2019 1,188 views

## 1 answer to this question.

This should work:

`poker_face <- replicate(1000, sample(poker, size =2, replace = FALSE))`
• 910 points

+1 vote

## Difference between factor and as.factor in R programming

Hey @Ali, as.factor is a wrapper for ...READ MORE

## What is active binding in R programming

Active bindings in R are much like ...READ MORE

+1 vote

+1 vote

## Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

+1 vote

## How to segment documents into phrases in text mining using R?

You can do this in R using ...READ MORE

## Trying to find frequent itemsets of a data set using arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", "milk", ...READ MORE