There are many types of data in R
Numeric
Example-1,2.0,23,123.5
Integer
Example- 1k,23L,230K
Complex
Example-2+6i,8+9i,1/(i-1)
Logical
Example- True, False
Character
Example:"c", "Mathematics", "2 plus 3."
R has basic data Structures
Vector
> c(1, 3, 5, 7, 8, 9)
[1] 1 3 5 7 8 9
> x = c(2, 4, 6, 8, 10, 12)
> c(46, "Mathematics", TRUE)
[1] "46" "Mathematics" "TRUE"
(y = 1:120)
[1] 1 2 3 4 5 6 7 8 9 10
[11] 11 12 13 14 15 16 17 18 19 20
[21] 21 22 23 24 25 26 27 28 29 30
[31] 31 32 33 34 35 36 37 38 39 40
[41] 41 42 43 44 45 46 47 48 49 50
[51] 51 52 53 54 55 56 57 58 59 60
[61] 61 62 63 64 65 66 67 68 69 70
[71] 71 72 73 74 75 76 77 78 79 80
[81] 81 82 83 84 85 86 87 88 89 90
[91] 91 92 93 94 95 96 97 98 99 100
[101] 101 102 103 104 105 106 107 108 109 110
[111] 111 112 113 114 115 116 117 118 119 120
>seq(from = 0.5, to = 4.2, by = 0.1)
[1] 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4
[11] 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4
[21] 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4
[31] 3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2
> c(x, rep(seq(1, 7, 2), 3), c(1, 2, 3), 46, 2:4)
[1] 2 4 6 8 10 12 1 3 5 7 1 3 5 7
[15] 1 3 5 7 1 2 3 46 2 3 4
Matrix
> x = 1:8
> x
[1] 1 2 3 4 5 6 7 8
> Y = matrix(x, nrow = , ncol = 2, byrow = TRUE)
> y
[1] 1 2 3 4 5 6 7 8 9 10
[11] 11 12 13 14 15 16 17 18 19 20
[21] 21 22 23 24 25 26 27 28 29 30
[31] 31 32 33 34 35 36 37 38 39 40
[41] 41 42 43 44 45 46 47 48 49 50
[51] 51 52 53 54 55 56 57 58 59 60
[61] 61 62 63 64 65 66 67 68 69 70
[71] 71 72 73 74 75 76 77 78 79 80
[81] 81 82 83 84 85 86 87 88 89 90
[91] 91 92 93 94 95 96 97 98 99 100
[101] 101 102 103 104 105 106 107 108 109 110
[111] 111 112 113 114 115 116 117 118 119 120
List
list(40, "Hello", TRUE)
[[1]]
[1] 40
[[2]]
[1] "Hello"
[[3]]
[1] TRUE
Data Frame
> (test_sample = rnorm(n = 10, mean = 2, sd = 5))
[1] 8.725094 -2.190330 2.573350 -7.649668
[5] 6.420524 2.465019 4.561855 -8.622215
[9] 7.883495 5.382970
1 Comments
How about we see how to make it free from wreckage and be unstressed:
ReplyDeletemachine learning course