Numeric vectors¶
c(1.2,3.5,5.0,6.7,1.09e-3)
[1] 1.20000 3.50000 5.00000 6.70000 0.00109
x <- c(1.2,3.5,5.0,6.7,1.09e-3)
length(x)
[1] 5
1:100
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[19] 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
[37] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
[55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
[73] 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
[91] 91 92 93 94 95 96 97 98 99 100
x <- c(1,2,3,4,5)
y <- c(3,2,3,2,3)
z <- x + y
print(z)
[1] 4 4 6 6 8
x <- c(3,2,4,8,7)
y <- x + 1
print(y)
[1] 4 3 5 9 8
x <- c(3,2,4,8,7)
y <- x + c(1,1,1,1,1)
print(y)
[1] 4 3 5 9 8
1 + NA
[1] NA
x <- c(-2,-1,0,1,2)
1/x
[1] -0.5 -1.0 Inf 1.0 0.5
x/0
[1] -Inf -Inf NaN Inf Inf
- R file: numeric-vectors.R
- Rmarkdown file: numeric-vectors.Rmd
- Jupyter notebook file: numeric-vectors.ipynb
- Interactive version of the Jupyter notebook (shuts down after 60s):
- Interactive version of the Jupyter notebook (sign in required):