शुरू करेंमुफ़्त में शुरू करें

Make a plot

Finally, let us construct a plot that shows the probability of a match by sample size, using the pbirthday function that we practiced using in the previous exercise.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Probability Puzzles in R

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Set the variable room_sizes equal to the set of integers from 1 through 50.
  • Run the pbirthday function in an sapply call with the vector of room sizes and store the result as match_probs.
  • Make a plot with room size on the x-axis and match probability on the y-axis, using the two variables that you created.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Define the vector of sample sizes
room_sizes <- ___

# Run the pbirthday function within sapply on the vector of sample sizes
match_probs <- sapply(___)

# Create the plot
plot(___ ~ ___)
कोड संपादित करें और चलाएँ