Why should I use set seed function in R

0 votes
Apr 24, 2018 in Data Analytics by shams
• 3,670 points
1,815 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
82,285 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,140 points
7,463 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
830 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,030 points
40,681 views
0 votes
0 answers

Why I cannot save mutate result in r?

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

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

How to use Aggregate function in R

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

answered Jun 24, 2022 in Data Analytics by Sohail
• 3,040 points
594 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,870 points
56,631 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
986 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP