首页 > 代码库 > Useful R functions

Useful R functions

Random Samples and Permutations

sample(x, size, replace = FALSE, prob = NULL) sample.int(n, size = n, replace = FALSE, prob = NULL)

 

Samples in Normal Distribution

rnorm(n, mean = 0, sd = 1)

 

Generate Factor Levels

gl(n, k, length = n*k, labels = seq_len(n), ordered = FALSE)

 

Useful R functions