R programming: Monte Carlo Simulation

0 votes

I'm trying to implement Monte Carlo Simulation to sample out 50 instances of iris data. Any help would be appreciated.

Feb 19 in Data Analytics by Sophie may
• 9,430 points
77 views

1 answer to this question.

0 votes

You can use the sample_n from dplyr to select 50 rows with replacement.

# Set seed for reproducibility
set.seed(12800)

library(dplyr)
library(purrr)

iris_sub <- iris %>% sample_n(size = 50, replace = TRUE)

Hope this helps.

answered Feb 19 by Tyrion anex
• 8,280 points

Related Questions In Data Analytics

0 votes
1 answer

R programming: Flip coin simulation

Make use of the ggplot2 package. Start by installing and ...READ MORE

answered Jan 21 in Data Analytics by Sophie may
• 9,430 points
48 views
0 votes
1 answer

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

A variable name in R programming language ...READ MORE

answered Sep 7, 2018 in Data Analytics by zombie
• 3,690 points
70 views
0 votes
1 answer

Why should I adopt R programming

R Programming is the best mechanism for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,040 points
16 views
0 votes
1 answer

Error: could not find function - R Programming

This error usually occurs when a package ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,040 points
294 views
+1 vote
2 answers
0 votes
1 answer

R programming logic

Use gsub to match the substring that we want ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,040 points
21 views
0 votes
1 answer
+4 votes
2 answers
0 votes
1 answer

R programming error

Alright, you can either use gsub to match the ...READ MORE

answered Dec 18, 2018 in Data Analytics by Tyrion anex
• 8,280 points
16 views
0 votes
1 answer

Check if a matrix is diagonalizable in R Programming Language

On a given matrix, a, the first way ...READ MORE

answered Dec 24, 2018 in Data Analytics by Tyrion anex
• 8,280 points
22 views