R - (Numeric|Double) Vector

About

Numeric vector for real numbers

Code

Management

Initialization

Deterministic

> numVec = c(1,-2,3.3,7,-3)  # c = combine function
[1]  1.0 -2.0  3.3  7.0 -3.0
> class(numVec)
[1] "numeric"
> ?numeric  #Help
> is.numeric(numVec)
[1] TRUE

Random

  • Generate 5 random numeric between 0 and 1. See R - Sample
set.seed(1)
sample(1:100, 5)/100
[1] 0.44 0.50 0.31 0.51 0.86
  • Random in the normal distribution
runif(n, min = 0, max = 1)

Powered by ComboStrap