R - (Numeric|Double) Vector

> Procedural Languages > R

1 - About

Numeric vector for real numbers

Advertising

3 - Code

4 - Management

4.1 - Initialization

4.1.1 - 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

4.1.2 - 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)