Create Data Set Containing Random Sequence without Duplicates
In this method to create data set containing random sequences without duplicates, the user needs to call the randomsequence() function of the random package to get the random sequence without duplicates passed with the required parameters passed to it, and the sequence without duplicates will be created accordingly in the R programming language.
Example:
In this example, we are calling the randomsequence function passed with the min and max number which sets the limit to the random numbers generated, and further, we have passed the col parameter to the function which specifies the column’s needs and further the random sequence without duplicates as per the required parameters passed in the R programming language.
R
dataset= randomSequence ( min = 5, max = 40, col = 4) dataset |
Output:
V1 V2 V3 V4 [1,] 34 19 13 25 [2,] 12 20 15 33 [3,] 8 6 16 18 [4,] 21 9 39 32 [5,] 40 22 14 24 [6,] 23 28 35 17 [7,] 30 7 5 29 [8,] 37 31 38 27 [9,] 11 26 36 10
Random Package in R
In this article, we will discuss the random package including its use with working examples in the R programming language.