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,543 views

## 1 answer to this question.

This should work:

`poker_face <- replicate(1000, sample(poker, size =2, replace = FALSE))`
answered May 27, 2019 by
• 910 points

## What are the rules to define a variable name in R programming language?

The same rules almost follow for all ...READ MORE

+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

## Remove NA values from the output in R programming

Edit your code: columnmean <- function(x, removeNA = ...READ MORE

## Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

+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

## Changing variable values using R programming

This should work: df\$symbol <- as.character(df\$symbol) df\$symbol[df\$symbol == "ABCD.BO"] ...READ MORE

## R programming error: Plot error - “Col=”red“

Fix this line: polygon(c(0,0,1),c(1,2,1), col="red", density=c(30, ...READ MORE