Converting a z-score to a P-value

pnorm(1.4)
## [1] 0.9192433

Random whole numbers in a specified range

The replace option determines whether you can select the same value multiple times

sample(1:10, 50, replace=TRUE)
##  [1]  8  4  5  1  6  8  1  8  8  8  2  6  4  3  4 10 10 10  2  3  9  2  8  4  6
## [26]  8  3  1  7  2  4  4  3  3  1  1 10  2  5  2  5  3  7  8  9  7  6  5  1  6

Random values from different probability distributions

From a normal distribution:

rnorm(20, mean=5, sd=2)
##  [1] 6.3063286 3.6866723 3.1292387 3.3662880 5.6503341 4.0785388 6.3375178
##  [8] 2.9553209 7.8062061 3.0638712 3.5745446 0.8790988 8.1214046 3.1838938
## [15] 0.9371560 8.2429729 6.4456305 4.0796264 5.1747902 4.8842624

From a binomial distribution:

rbinom(20,prob=.3, size=10)
##  [1] 5 5 4 5 2 4 3 5 5 1 2 4 3 0 3 7 2 2 4 1