Answers for "how to make a dataset with random values in r"

R
2

how to add random numbers randomly in a dataframe in r

# 1000 random numbers with 0 or 1 values:

a <-sample(0:1, 1000, rep = TRUE)

# 0 1 1 0 0 0 1 0 ...
Posted by: Guest on October-19-2020
0

extracting random data set in r

sample <- diamonds[sample(nrow(diamonds),100),]
sample
Posted by: Guest on September-11-2021

Code answers related to "how to make a dataset with random values in r"

Browse Popular Code Answers by Language