Why should I use set seed function in R

0 votes
Apr 24, 2018 in Data Analytics by shams
• 3,660 points
883 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 24, 2018 by zombie
• 3,790 points

Related Questions In Data Analytics

+1 vote
2 answers

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
48,982 views
+1 vote
1 answer

How can I use which() function in R ?

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

answered Sep 25, 2018 in Data Analytics by Daisy
• 8,120 points
6,670 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,840 points
249 views
+1 vote
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, 2019 in Data Analytics by anonymous
• 33,010 points
19,768 views
0 votes
0 answers

Why I cannot save mutate result in r?

I tried to rank "date" within each ...READ MORE

Jun 9 in Data Analytics by Avinash
• 1,260 points
11 views
0 votes
1 answer

How to use Aggregate function in R

Where dat is the name of your ...READ MORE

answered Jun 24 in Data Analytics by Sohail
• 2,960 points
19 views
0 votes
2 answers

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

The function match works on vectors : x <- sample(1:10) x # ...READ MORE

answered Dec 12, 2020 in Data Analytics by Rajiv
• 8,910 points
52,195 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,790 points
322 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP