Why should I use set.seed function() in R?

0 votes
Apr 23, 2018 in Data Analytics by shams
• 3,580 points
18 views

1 answer to this question.

0 votes
set.seed(seed)
Set the seed of R‘s random number generator, which is useful for creating simulations or random objects that can be reproduced.
seed – A number.

Example. Create simulated values that are reproducible.
> set.seed(5)
> rnorm(5)
[1] -0.84085548  1.38435934 -1.25549186  0.07014277  1.71144087
> set.seed(5)
> rnorm(5)
[1] -0.84085548  1.38435934 -1.25549186  0.07014277  1.71144087
The seed number you choose is the starting point used in the generation of a sequence of random numbers, which is why (provided you use the same pseudo-random number generator) you'll obtain the same results given the same seed number.
answered Apr 23, 2018 by zombie
• 3,690 points

Related Questions In Data Analytics

0 votes
1 answer

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
910 views
0 votes
1 answer

How can I use which() function in R ?

which() function determines the position of elements ...READ MORE

answered Sep 24, 2018 in Data Analytics by Daisy
• 8,040 points
25 views
0 votes
1 answer
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
0 votes
1 answer

What is set.seed() in R?

Let me explain in simple words, set seed ...READ MORE

answered Jul 9 in Data Analytics by anonymous
• 17,870 points
16 views
0 votes
1 answer

How to use group by for multiple columns in dplyr, using string vector input in R?

dplyr added versions for group_by. This allows you ...READ MORE

answered Apr 12, 2018 in Data Analytics by CodingByHeart77
• 3,680 points

edited Apr 12, 2018 by CodingByHeart77 2,227 views
0 votes
1 answer

How to set global variables in R

To set global variables, you can use ...READ MORE

answered Apr 23, 2018 in Data Analytics by kappa3010
• 2,010 points
73 views
0 votes
1 answer

R function for finding the index of an element in a vector?

Yes, we can find the index of ...READ MORE

answered Apr 13, 2018 in Data Analytics by zombie
• 3,690 points
161 views
0 votes
1 answer

How can I select a CRAN mirror in R ?

There are many ways of doing so ...READ MORE

answered May 9, 2018 in Data Analytics by zombie
• 3,690 points
28 views