DAY 2
Learning Data Manipulation
Hey Debishree till last class we learnt basic functions in R, i hope you have practiced them well. In todays class We’ll create a data frame, plot few graphs, and perform some actions on imported data set. So let’s begin.Creating Data frame
Last day we learnt how to create a vector or list, now we’ll learn how to create a 3D version of those data sets my combining them.
Suppose we need to make a table that have three columns named “Patient id”, “Treatment” and “Response”.
For example lets create These data vectors first and brushup the old concepts again.
Lets start with creating “Patientid”
## [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 101 102 103 104 105 106 107 108
## [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
## [127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
## [145] 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
## [163] 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
## [181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
## [199] 199 200
Now lets create datas for “Treatment” column, here we are using a new function called “rep” just to repeat the given CHARACTER specified number of time.
group <- rep(c(rep("Drugs", 50), rep("Operation", 50)), 2) #here last wala 2 just repeats the whole dataset twice
group## [1] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [7] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [13] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [19] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [25] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [31] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [37] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [43] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [49] "Drugs" "Drugs" "Operation" "Operation" "Operation" "Operation"
## [55] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [61] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [67] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [73] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [79] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [85] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [91] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [97] "Operation" "Operation" "Operation" "Operation" "Drugs" "Drugs"
## [103] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [109] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [115] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [121] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [127] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [133] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [139] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [145] "Drugs" "Drugs" "Drugs" "Drugs" "Drugs" "Drugs"
## [151] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [157] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [163] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [169] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [175] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [181] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [187] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [193] "Operation" "Operation" "Operation" "Operation" "Operation" "Operation"
## [199] "Operation" "Operation"
Now let’s create the datas for the last column “Response”
## [1] 25.37805 29.35250 23.15573 22.34278 24.49525 31.10806 25.64890 26.32642
## [9] 26.53815 26.66279 19.84519 22.34266 25.18868 24.67858 24.37904 23.23941
## [17] 26.20763 23.36145 21.62812 24.82285 23.67047 25.41011 21.72210 26.32198
## [25] 28.61852 25.72780 23.14321 22.99242 24.61048 24.87939 24.95985 23.94781
## [33] 23.90715 25.05076 27.16978 23.94976 25.81556 25.12458 25.28249 25.74337
## [41] 25.52084 22.79985 25.20061 22.72915 28.83948 25.35301 23.98216 24.83805
## [49] 25.07423 27.78228 23.93810 27.97765 26.32351 23.68767 22.27763 23.72934
## [57] 27.70327 23.29378 25.19191 26.13807 25.39174 24.98601 23.71981 25.19561
## [65] 28.69099 26.78643 25.67741 25.48104 25.16506 25.08223 23.79738 25.44696
## [73] 27.94398 23.99690 24.25204 23.68414 27.37525 29.43554 26.98063 26.64868
## [81] 26.16300 23.78435 23.35071 26.82964 28.57192 26.28278 27.08561 29.53004
## [89] 26.59327 25.71444 27.37487 23.14629 26.94952 26.09082 26.40891 26.74826
## [97] 23.76873 26.95642 22.97945 25.69920 51.38623 51.27056 50.69855 48.57385
## [105] 50.56264 50.62205 47.55073 48.26115 47.47901 53.00770 49.31766 50.50474
## [113] 49.37976 49.45181 48.76687 49.10740 46.68019 47.07578 51.81457 47.90884
## [121] 47.38757 48.35900 49.01321 49.36733 52.13025 47.40284 46.76871 46.38544
## [129] 52.11236 50.20473 49.94347 50.60087 48.01119 52.01249 49.81781 47.79751
## [137] 50.06740 49.58008 50.91318 50.70042 52.54956 51.81589 52.22745 48.61533
## [145] 53.23888 49.46232 51.08607 51.50899 49.69557 49.31178 45.73861 48.27009
## [153] 51.02460 49.59785 51.46550 48.29424 49.66577 51.46073 50.03197 51.84824
## [161] 46.98132 49.23165 52.69983 49.61916 47.75723 50.36247 50.97879 53.98228
## [169] 51.46016 50.34258 50.68373 46.55345 47.99522 51.01831 48.11121 50.43327
## [177] 50.90240 53.02951 48.62498 48.50661 51.67113 45.86621 50.07979 48.43482
## [185] 49.51399 49.12689 51.25011 47.76441 50.21112 53.39207 52.09908 51.56274
## [193] 49.17839 50.25220 50.75019 50.99132 53.01155 48.23115 46.87365 48.56689
Now We’ll merge all the data sets in one data frame.
TO do this we’ll use “data.frame()”, function; here we’ll first give the column name and assign a vector value to it by “=” sign. for example if we are inserting the values of id in column name “patient id, we’ll input”Patient id = id” in the “data.frame()” function.
## Patient Treatment Response
## 1 1 Drugs 25.37805
## 2 2 Drugs 29.35250
## 3 3 Drugs 23.15573
## 4 4 Drugs 22.34278
## 5 5 Drugs 24.49525
## 6 6 Drugs 31.10806
## 7 7 Drugs 25.64890
## 8 8 Drugs 26.32642
## 9 9 Drugs 26.53815
## 10 10 Drugs 26.66279
## 11 11 Drugs 19.84519
## 12 12 Drugs 22.34266
## 13 13 Drugs 25.18868
## 14 14 Drugs 24.67858
## 15 15 Drugs 24.37904
## 16 16 Drugs 23.23941
## 17 17 Drugs 26.20763
## 18 18 Drugs 23.36145
## 19 19 Drugs 21.62812
## 20 20 Drugs 24.82285
## 21 21 Drugs 23.67047
## 22 22 Drugs 25.41011
## 23 23 Drugs 21.72210
## 24 24 Drugs 26.32198
## 25 25 Drugs 28.61852
## 26 26 Drugs 25.72780
## 27 27 Drugs 23.14321
## 28 28 Drugs 22.99242
## 29 29 Drugs 24.61048
## 30 30 Drugs 24.87939
## 31 31 Drugs 24.95985
## 32 32 Drugs 23.94781
## 33 33 Drugs 23.90715
## 34 34 Drugs 25.05076
## 35 35 Drugs 27.16978
## 36 36 Drugs 23.94976
## 37 37 Drugs 25.81556
## 38 38 Drugs 25.12458
## 39 39 Drugs 25.28249
## 40 40 Drugs 25.74337
## 41 41 Drugs 25.52084
## 42 42 Drugs 22.79985
## 43 43 Drugs 25.20061
## 44 44 Drugs 22.72915
## 45 45 Drugs 28.83948
## 46 46 Drugs 25.35301
## 47 47 Drugs 23.98216
## 48 48 Drugs 24.83805
## 49 49 Drugs 25.07423
## 50 50 Drugs 27.78228
## 51 51 Operation 23.93810
## 52 52 Operation 27.97765
## 53 53 Operation 26.32351
## 54 54 Operation 23.68767
## 55 55 Operation 22.27763
## 56 56 Operation 23.72934
## 57 57 Operation 27.70327
## 58 58 Operation 23.29378
## 59 59 Operation 25.19191
## 60 60 Operation 26.13807
## 61 61 Operation 25.39174
## 62 62 Operation 24.98601
## 63 63 Operation 23.71981
## 64 64 Operation 25.19561
## 65 65 Operation 28.69099
## 66 66 Operation 26.78643
## 67 67 Operation 25.67741
## 68 68 Operation 25.48104
## 69 69 Operation 25.16506
## 70 70 Operation 25.08223
## 71 71 Operation 23.79738
## 72 72 Operation 25.44696
## 73 73 Operation 27.94398
## 74 74 Operation 23.99690
## 75 75 Operation 24.25204
## 76 76 Operation 23.68414
## 77 77 Operation 27.37525
## 78 78 Operation 29.43554
## 79 79 Operation 26.98063
## 80 80 Operation 26.64868
## 81 81 Operation 26.16300
## 82 82 Operation 23.78435
## 83 83 Operation 23.35071
## 84 84 Operation 26.82964
## 85 85 Operation 28.57192
## 86 86 Operation 26.28278
## 87 87 Operation 27.08561
## 88 88 Operation 29.53004
## 89 89 Operation 26.59327
## 90 90 Operation 25.71444
## 91 91 Operation 27.37487
## 92 92 Operation 23.14629
## 93 93 Operation 26.94952
## 94 94 Operation 26.09082
## 95 95 Operation 26.40891
## 96 96 Operation 26.74826
## 97 97 Operation 23.76873
## 98 98 Operation 26.95642
## 99 99 Operation 22.97945
## 100 100 Operation 25.69920
## 101 101 Drugs 51.38623
## 102 102 Drugs 51.27056
## 103 103 Drugs 50.69855
## 104 104 Drugs 48.57385
## 105 105 Drugs 50.56264
## 106 106 Drugs 50.62205
## 107 107 Drugs 47.55073
## 108 108 Drugs 48.26115
## 109 109 Drugs 47.47901
## 110 110 Drugs 53.00770
## 111 111 Drugs 49.31766
## 112 112 Drugs 50.50474
## 113 113 Drugs 49.37976
## 114 114 Drugs 49.45181
## 115 115 Drugs 48.76687
## 116 116 Drugs 49.10740
## 117 117 Drugs 46.68019
## 118 118 Drugs 47.07578
## 119 119 Drugs 51.81457
## 120 120 Drugs 47.90884
## 121 121 Drugs 47.38757
## 122 122 Drugs 48.35900
## 123 123 Drugs 49.01321
## 124 124 Drugs 49.36733
## 125 125 Drugs 52.13025
## 126 126 Drugs 47.40284
## 127 127 Drugs 46.76871
## 128 128 Drugs 46.38544
## 129 129 Drugs 52.11236
## 130 130 Drugs 50.20473
## 131 131 Drugs 49.94347
## 132 132 Drugs 50.60087
## 133 133 Drugs 48.01119
## 134 134 Drugs 52.01249
## 135 135 Drugs 49.81781
## 136 136 Drugs 47.79751
## 137 137 Drugs 50.06740
## 138 138 Drugs 49.58008
## 139 139 Drugs 50.91318
## 140 140 Drugs 50.70042
## 141 141 Drugs 52.54956
## 142 142 Drugs 51.81589
## 143 143 Drugs 52.22745
## 144 144 Drugs 48.61533
## 145 145 Drugs 53.23888
## 146 146 Drugs 49.46232
## 147 147 Drugs 51.08607
## 148 148 Drugs 51.50899
## 149 149 Drugs 49.69557
## 150 150 Drugs 49.31178
## 151 151 Operation 45.73861
## 152 152 Operation 48.27009
## 153 153 Operation 51.02460
## 154 154 Operation 49.59785
## 155 155 Operation 51.46550
## 156 156 Operation 48.29424
## 157 157 Operation 49.66577
## 158 158 Operation 51.46073
## 159 159 Operation 50.03197
## 160 160 Operation 51.84824
## 161 161 Operation 46.98132
## 162 162 Operation 49.23165
## 163 163 Operation 52.69983
## 164 164 Operation 49.61916
## 165 165 Operation 47.75723
## 166 166 Operation 50.36247
## 167 167 Operation 50.97879
## 168 168 Operation 53.98228
## 169 169 Operation 51.46016
## 170 170 Operation 50.34258
## 171 171 Operation 50.68373
## 172 172 Operation 46.55345
## 173 173 Operation 47.99522
## 174 174 Operation 51.01831
## 175 175 Operation 48.11121
## 176 176 Operation 50.43327
## 177 177 Operation 50.90240
## 178 178 Operation 53.02951
## 179 179 Operation 48.62498
## 180 180 Operation 48.50661
## 181 181 Operation 51.67113
## 182 182 Operation 45.86621
## 183 183 Operation 50.07979
## 184 184 Operation 48.43482
## 185 185 Operation 49.51399
## 186 186 Operation 49.12689
## 187 187 Operation 51.25011
## 188 188 Operation 47.76441
## 189 189 Operation 50.21112
## 190 190 Operation 53.39207
## 191 191 Operation 52.09908
## 192 192 Operation 51.56274
## 193 193 Operation 49.17839
## 194 194 Operation 50.25220
## 195 195 Operation 50.75019
## 196 196 Operation 50.99132
## 197 197 Operation 53.01155
## 198 198 Operation 48.23115
## 199 199 Operation 46.87365
## 200 200 Operation 48.56689
SUbsetting DataFrame
we can extract any specific value from the data frame using [rows, column]. Remember Rows always comes first. For example mydata[2,3] will provide us the data in 2nd row and 3rd column.
## [1] "Drugs"
## Treatment Response
## 1 Drugs 25.37805
## 2 Drugs 29.35250
## 3 Drugs 23.15573
## 4 Drugs 22.34278
## 5 Drugs 24.49525
## 6 Drugs 31.10806
## 7 Drugs 25.64890
## 8 Drugs 26.32642
## 9 Drugs 26.53815
## 10 Drugs 26.66279
## 11 Drugs 19.84519
## 12 Drugs 22.34266
## 13 Drugs 25.18868
## 14 Drugs 24.67858
## 15 Drugs 24.37904
## 16 Drugs 23.23941
## 17 Drugs 26.20763
## 18 Drugs 23.36145
## 19 Drugs 21.62812
## 20 Drugs 24.82285
Filtering directly by names
mydata[,"Response"] #You must have noticed the first value before comma is empty it denotes you have to take all the Rows.## [1] 25.37805 29.35250 23.15573 22.34278 24.49525 31.10806 25.64890 26.32642
## [9] 26.53815 26.66279 19.84519 22.34266 25.18868 24.67858 24.37904 23.23941
## [17] 26.20763 23.36145 21.62812 24.82285 23.67047 25.41011 21.72210 26.32198
## [25] 28.61852 25.72780 23.14321 22.99242 24.61048 24.87939 24.95985 23.94781
## [33] 23.90715 25.05076 27.16978 23.94976 25.81556 25.12458 25.28249 25.74337
## [41] 25.52084 22.79985 25.20061 22.72915 28.83948 25.35301 23.98216 24.83805
## [49] 25.07423 27.78228 23.93810 27.97765 26.32351 23.68767 22.27763 23.72934
## [57] 27.70327 23.29378 25.19191 26.13807 25.39174 24.98601 23.71981 25.19561
## [65] 28.69099 26.78643 25.67741 25.48104 25.16506 25.08223 23.79738 25.44696
## [73] 27.94398 23.99690 24.25204 23.68414 27.37525 29.43554 26.98063 26.64868
## [81] 26.16300 23.78435 23.35071 26.82964 28.57192 26.28278 27.08561 29.53004
## [89] 26.59327 25.71444 27.37487 23.14629 26.94952 26.09082 26.40891 26.74826
## [97] 23.76873 26.95642 22.97945 25.69920 51.38623 51.27056 50.69855 48.57385
## [105] 50.56264 50.62205 47.55073 48.26115 47.47901 53.00770 49.31766 50.50474
## [113] 49.37976 49.45181 48.76687 49.10740 46.68019 47.07578 51.81457 47.90884
## [121] 47.38757 48.35900 49.01321 49.36733 52.13025 47.40284 46.76871 46.38544
## [129] 52.11236 50.20473 49.94347 50.60087 48.01119 52.01249 49.81781 47.79751
## [137] 50.06740 49.58008 50.91318 50.70042 52.54956 51.81589 52.22745 48.61533
## [145] 53.23888 49.46232 51.08607 51.50899 49.69557 49.31178 45.73861 48.27009
## [153] 51.02460 49.59785 51.46550 48.29424 49.66577 51.46073 50.03197 51.84824
## [161] 46.98132 49.23165 52.69983 49.61916 47.75723 50.36247 50.97879 53.98228
## [169] 51.46016 50.34258 50.68373 46.55345 47.99522 51.01831 48.11121 50.43327
## [177] 50.90240 53.02951 48.62498 48.50661 51.67113 45.86621 50.07979 48.43482
## [185] 49.51399 49.12689 51.25011 47.76441 50.21112 53.39207 52.09908 51.56274
## [193] 49.17839 50.25220 50.75019 50.99132 53.01155 48.23115 46.87365 48.56689
Filtering by conditions
To select any particular value from any rows or column we use dollor sign, for examle to only select the column and perform any mathematical fucntion on it, here we selected the Responce column by “mydata$Response” and stated it should be greater than 26, then we left the column section after comma blanck to select all the columns. The following will go to response and filter out data whose response is greater than 26
## Patient Treatment Response
## 2 2 Drugs 29.35250
## 6 6 Drugs 31.10806
## 8 8 Drugs 26.32642
## 9 9 Drugs 26.53815
## 10 10 Drugs 26.66279
## 17 17 Drugs 26.20763
## 24 24 Drugs 26.32198
## 25 25 Drugs 28.61852
## 35 35 Drugs 27.16978
## 45 45 Drugs 28.83948
## 50 50 Drugs 27.78228
## 52 52 Operation 27.97765
## 53 53 Operation 26.32351
## 57 57 Operation 27.70327
## 60 60 Operation 26.13807
## 65 65 Operation 28.69099
## 66 66 Operation 26.78643
## 73 73 Operation 27.94398
## 77 77 Operation 27.37525
## 78 78 Operation 29.43554
## 79 79 Operation 26.98063
## 80 80 Operation 26.64868
## 81 81 Operation 26.16300
## 84 84 Operation 26.82964
## 85 85 Operation 28.57192
## 86 86 Operation 26.28278
## 87 87 Operation 27.08561
## 88 88 Operation 29.53004
## 89 89 Operation 26.59327
## 91 91 Operation 27.37487
## 93 93 Operation 26.94952
## 94 94 Operation 26.09082
## 95 95 Operation 26.40891
## 96 96 Operation 26.74826
## 98 98 Operation 26.95642
## 101 101 Drugs 51.38623
## 102 102 Drugs 51.27056
## 103 103 Drugs 50.69855
## 104 104 Drugs 48.57385
## 105 105 Drugs 50.56264
## 106 106 Drugs 50.62205
## 107 107 Drugs 47.55073
## 108 108 Drugs 48.26115
## 109 109 Drugs 47.47901
## 110 110 Drugs 53.00770
## 111 111 Drugs 49.31766
## 112 112 Drugs 50.50474
## 113 113 Drugs 49.37976
## 114 114 Drugs 49.45181
## 115 115 Drugs 48.76687
## 116 116 Drugs 49.10740
## 117 117 Drugs 46.68019
## 118 118 Drugs 47.07578
## 119 119 Drugs 51.81457
## 120 120 Drugs 47.90884
## 121 121 Drugs 47.38757
## 122 122 Drugs 48.35900
## 123 123 Drugs 49.01321
## 124 124 Drugs 49.36733
## 125 125 Drugs 52.13025
## 126 126 Drugs 47.40284
## 127 127 Drugs 46.76871
## 128 128 Drugs 46.38544
## 129 129 Drugs 52.11236
## 130 130 Drugs 50.20473
## 131 131 Drugs 49.94347
## 132 132 Drugs 50.60087
## 133 133 Drugs 48.01119
## 134 134 Drugs 52.01249
## 135 135 Drugs 49.81781
## 136 136 Drugs 47.79751
## 137 137 Drugs 50.06740
## 138 138 Drugs 49.58008
## 139 139 Drugs 50.91318
## 140 140 Drugs 50.70042
## 141 141 Drugs 52.54956
## 142 142 Drugs 51.81589
## 143 143 Drugs 52.22745
## 144 144 Drugs 48.61533
## 145 145 Drugs 53.23888
## 146 146 Drugs 49.46232
## 147 147 Drugs 51.08607
## 148 148 Drugs 51.50899
## 149 149 Drugs 49.69557
## 150 150 Drugs 49.31178
## 151 151 Operation 45.73861
## 152 152 Operation 48.27009
## 153 153 Operation 51.02460
## 154 154 Operation 49.59785
## 155 155 Operation 51.46550
## 156 156 Operation 48.29424
## 157 157 Operation 49.66577
## 158 158 Operation 51.46073
## 159 159 Operation 50.03197
## 160 160 Operation 51.84824
## 161 161 Operation 46.98132
## 162 162 Operation 49.23165
## 163 163 Operation 52.69983
## 164 164 Operation 49.61916
## 165 165 Operation 47.75723
## 166 166 Operation 50.36247
## 167 167 Operation 50.97879
## 168 168 Operation 53.98228
## 169 169 Operation 51.46016
## 170 170 Operation 50.34258
## 171 171 Operation 50.68373
## 172 172 Operation 46.55345
## 173 173 Operation 47.99522
## 174 174 Operation 51.01831
## 175 175 Operation 48.11121
## 176 176 Operation 50.43327
## 177 177 Operation 50.90240
## 178 178 Operation 53.02951
## 179 179 Operation 48.62498
## 180 180 Operation 48.50661
## 181 181 Operation 51.67113
## 182 182 Operation 45.86621
## 183 183 Operation 50.07979
## 184 184 Operation 48.43482
## 185 185 Operation 49.51399
## 186 186 Operation 49.12689
## 187 187 Operation 51.25011
## 188 188 Operation 47.76441
## 189 189 Operation 50.21112
## 190 190 Operation 53.39207
## 191 191 Operation 52.09908
## 192 192 Operation 51.56274
## 193 193 Operation 49.17839
## 194 194 Operation 50.25220
## 195 195 Operation 50.75019
## 196 196 Operation 50.99132
## 197 197 Operation 53.01155
## 198 198 Operation 48.23115
## 199 199 Operation 46.87365
## 200 200 Operation 48.56689
And “&&” and Or “|” operators
Applying multiple operator for subsetting and filtering AND operator: it will filter out the results which will satisfy both the conditions
## Warning in mydata$Treatment == "Drugs" && mydata$Response < 50: 'length(x) =
## 200 > 1' in coercion to 'logical(1)'
## Warning in mydata$Treatment == "Drugs" && mydata$Response < 50: 'length(x) =
## 200 > 1' in coercion to 'logical(1)'
## Patient Treatment Response
## 1 1 Drugs 25.37805
## 2 2 Drugs 29.35250
## 3 3 Drugs 23.15573
## 4 4 Drugs 22.34278
## 5 5 Drugs 24.49525
## 6 6 Drugs 31.10806
## 7 7 Drugs 25.64890
## 8 8 Drugs 26.32642
## 9 9 Drugs 26.53815
## 10 10 Drugs 26.66279
## 11 11 Drugs 19.84519
## 12 12 Drugs 22.34266
## 13 13 Drugs 25.18868
## 14 14 Drugs 24.67858
## 15 15 Drugs 24.37904
## 16 16 Drugs 23.23941
## 17 17 Drugs 26.20763
## 18 18 Drugs 23.36145
## 19 19 Drugs 21.62812
## 20 20 Drugs 24.82285
## 21 21 Drugs 23.67047
## 22 22 Drugs 25.41011
## 23 23 Drugs 21.72210
## 24 24 Drugs 26.32198
## 25 25 Drugs 28.61852
## 26 26 Drugs 25.72780
## 27 27 Drugs 23.14321
## 28 28 Drugs 22.99242
## 29 29 Drugs 24.61048
## 30 30 Drugs 24.87939
## 31 31 Drugs 24.95985
## 32 32 Drugs 23.94781
## 33 33 Drugs 23.90715
## 34 34 Drugs 25.05076
## 35 35 Drugs 27.16978
## 36 36 Drugs 23.94976
## 37 37 Drugs 25.81556
## 38 38 Drugs 25.12458
## 39 39 Drugs 25.28249
## 40 40 Drugs 25.74337
## 41 41 Drugs 25.52084
## 42 42 Drugs 22.79985
## 43 43 Drugs 25.20061
## 44 44 Drugs 22.72915
## 45 45 Drugs 28.83948
## 46 46 Drugs 25.35301
## 47 47 Drugs 23.98216
## 48 48 Drugs 24.83805
## 49 49 Drugs 25.07423
## 50 50 Drugs 27.78228
## 51 51 Operation 23.93810
## 52 52 Operation 27.97765
## 53 53 Operation 26.32351
## 54 54 Operation 23.68767
## 55 55 Operation 22.27763
## 56 56 Operation 23.72934
## 57 57 Operation 27.70327
## 58 58 Operation 23.29378
## 59 59 Operation 25.19191
## 60 60 Operation 26.13807
## 61 61 Operation 25.39174
## 62 62 Operation 24.98601
## 63 63 Operation 23.71981
## 64 64 Operation 25.19561
## 65 65 Operation 28.69099
## 66 66 Operation 26.78643
## 67 67 Operation 25.67741
## 68 68 Operation 25.48104
## 69 69 Operation 25.16506
## 70 70 Operation 25.08223
## 71 71 Operation 23.79738
## 72 72 Operation 25.44696
## 73 73 Operation 27.94398
## 74 74 Operation 23.99690
## 75 75 Operation 24.25204
## 76 76 Operation 23.68414
## 77 77 Operation 27.37525
## 78 78 Operation 29.43554
## 79 79 Operation 26.98063
## 80 80 Operation 26.64868
## 81 81 Operation 26.16300
## 82 82 Operation 23.78435
## 83 83 Operation 23.35071
## 84 84 Operation 26.82964
## 85 85 Operation 28.57192
## 86 86 Operation 26.28278
## 87 87 Operation 27.08561
## 88 88 Operation 29.53004
## 89 89 Operation 26.59327
## 90 90 Operation 25.71444
## 91 91 Operation 27.37487
## 92 92 Operation 23.14629
## 93 93 Operation 26.94952
## 94 94 Operation 26.09082
## 95 95 Operation 26.40891
## 96 96 Operation 26.74826
## 97 97 Operation 23.76873
## 98 98 Operation 26.95642
## 99 99 Operation 22.97945
## 100 100 Operation 25.69920
## 101 101 Drugs 51.38623
## 102 102 Drugs 51.27056
## 103 103 Drugs 50.69855
## 104 104 Drugs 48.57385
## 105 105 Drugs 50.56264
## 106 106 Drugs 50.62205
## 107 107 Drugs 47.55073
## 108 108 Drugs 48.26115
## 109 109 Drugs 47.47901
## 110 110 Drugs 53.00770
## 111 111 Drugs 49.31766
## 112 112 Drugs 50.50474
## 113 113 Drugs 49.37976
## 114 114 Drugs 49.45181
## 115 115 Drugs 48.76687
## 116 116 Drugs 49.10740
## 117 117 Drugs 46.68019
## 118 118 Drugs 47.07578
## 119 119 Drugs 51.81457
## 120 120 Drugs 47.90884
## 121 121 Drugs 47.38757
## 122 122 Drugs 48.35900
## 123 123 Drugs 49.01321
## 124 124 Drugs 49.36733
## 125 125 Drugs 52.13025
## 126 126 Drugs 47.40284
## 127 127 Drugs 46.76871
## 128 128 Drugs 46.38544
## 129 129 Drugs 52.11236
## 130 130 Drugs 50.20473
## 131 131 Drugs 49.94347
## 132 132 Drugs 50.60087
## 133 133 Drugs 48.01119
## 134 134 Drugs 52.01249
## 135 135 Drugs 49.81781
## 136 136 Drugs 47.79751
## 137 137 Drugs 50.06740
## 138 138 Drugs 49.58008
## 139 139 Drugs 50.91318
## 140 140 Drugs 50.70042
## 141 141 Drugs 52.54956
## 142 142 Drugs 51.81589
## 143 143 Drugs 52.22745
## 144 144 Drugs 48.61533
## 145 145 Drugs 53.23888
## 146 146 Drugs 49.46232
## 147 147 Drugs 51.08607
## 148 148 Drugs 51.50899
## 149 149 Drugs 49.69557
## 150 150 Drugs 49.31178
## 151 151 Operation 45.73861
## 152 152 Operation 48.27009
## 153 153 Operation 51.02460
## 154 154 Operation 49.59785
## 155 155 Operation 51.46550
## 156 156 Operation 48.29424
## 157 157 Operation 49.66577
## 158 158 Operation 51.46073
## 159 159 Operation 50.03197
## 160 160 Operation 51.84824
## 161 161 Operation 46.98132
## 162 162 Operation 49.23165
## 163 163 Operation 52.69983
## 164 164 Operation 49.61916
## 165 165 Operation 47.75723
## 166 166 Operation 50.36247
## 167 167 Operation 50.97879
## 168 168 Operation 53.98228
## 169 169 Operation 51.46016
## 170 170 Operation 50.34258
## 171 171 Operation 50.68373
## 172 172 Operation 46.55345
## 173 173 Operation 47.99522
## 174 174 Operation 51.01831
## 175 175 Operation 48.11121
## 176 176 Operation 50.43327
## 177 177 Operation 50.90240
## 178 178 Operation 53.02951
## 179 179 Operation 48.62498
## 180 180 Operation 48.50661
## 181 181 Operation 51.67113
## 182 182 Operation 45.86621
## 183 183 Operation 50.07979
## 184 184 Operation 48.43482
## 185 185 Operation 49.51399
## 186 186 Operation 49.12689
## 187 187 Operation 51.25011
## 188 188 Operation 47.76441
## 189 189 Operation 50.21112
## 190 190 Operation 53.39207
## 191 191 Operation 52.09908
## 192 192 Operation 51.56274
## 193 193 Operation 49.17839
## 194 194 Operation 50.25220
## 195 195 Operation 50.75019
## 196 196 Operation 50.99132
## 197 197 Operation 53.01155
## 198 198 Operation 48.23115
## 199 199 Operation 46.87365
## 200 200 Operation 48.56689
OR operator: it will filter out the results which will satisfy either of the conditions
## Patient Treatment Response
## 1 1 Drugs 25.37805
## 2 2 Drugs 29.35250
## 3 3 Drugs 23.15573
## 4 4 Drugs 22.34278
## 5 5 Drugs 24.49525
## 6 6 Drugs 31.10806
## 7 7 Drugs 25.64890
## 8 8 Drugs 26.32642
## 9 9 Drugs 26.53815
## 10 10 Drugs 26.66279
## 11 11 Drugs 19.84519
## 12 12 Drugs 22.34266
## 13 13 Drugs 25.18868
## 14 14 Drugs 24.67858
## 15 15 Drugs 24.37904
## 16 16 Drugs 23.23941
## 17 17 Drugs 26.20763
## 18 18 Drugs 23.36145
## 19 19 Drugs 21.62812
## 20 20 Drugs 24.82285
## 21 21 Drugs 23.67047
## 22 22 Drugs 25.41011
## 23 23 Drugs 21.72210
## 24 24 Drugs 26.32198
## 25 25 Drugs 28.61852
## 26 26 Drugs 25.72780
## 27 27 Drugs 23.14321
## 28 28 Drugs 22.99242
## 29 29 Drugs 24.61048
## 30 30 Drugs 24.87939
## 31 31 Drugs 24.95985
## 32 32 Drugs 23.94781
## 33 33 Drugs 23.90715
## 34 34 Drugs 25.05076
## 35 35 Drugs 27.16978
## 36 36 Drugs 23.94976
## 37 37 Drugs 25.81556
## 38 38 Drugs 25.12458
## 39 39 Drugs 25.28249
## 40 40 Drugs 25.74337
## 41 41 Drugs 25.52084
## 42 42 Drugs 22.79985
## 43 43 Drugs 25.20061
## 44 44 Drugs 22.72915
## 45 45 Drugs 28.83948
## 46 46 Drugs 25.35301
## 47 47 Drugs 23.98216
## 48 48 Drugs 24.83805
## 49 49 Drugs 25.07423
## 50 50 Drugs 27.78228
## 51 51 Operation 23.93810
## 52 52 Operation 27.97765
## 53 53 Operation 26.32351
## 54 54 Operation 23.68767
## 55 55 Operation 22.27763
## 56 56 Operation 23.72934
## 57 57 Operation 27.70327
## 58 58 Operation 23.29378
## 59 59 Operation 25.19191
## 60 60 Operation 26.13807
## 61 61 Operation 25.39174
## 62 62 Operation 24.98601
## 63 63 Operation 23.71981
## 64 64 Operation 25.19561
## 65 65 Operation 28.69099
## 66 66 Operation 26.78643
## 67 67 Operation 25.67741
## 68 68 Operation 25.48104
## 69 69 Operation 25.16506
## 70 70 Operation 25.08223
## 71 71 Operation 23.79738
## 72 72 Operation 25.44696
## 73 73 Operation 27.94398
## 74 74 Operation 23.99690
## 75 75 Operation 24.25204
## 76 76 Operation 23.68414
## 77 77 Operation 27.37525
## 78 78 Operation 29.43554
## 79 79 Operation 26.98063
## 80 80 Operation 26.64868
## 81 81 Operation 26.16300
## 82 82 Operation 23.78435
## 83 83 Operation 23.35071
## 84 84 Operation 26.82964
## 85 85 Operation 28.57192
## 86 86 Operation 26.28278
## 87 87 Operation 27.08561
## 88 88 Operation 29.53004
## 89 89 Operation 26.59327
## 90 90 Operation 25.71444
## 91 91 Operation 27.37487
## 92 92 Operation 23.14629
## 93 93 Operation 26.94952
## 94 94 Operation 26.09082
## 95 95 Operation 26.40891
## 96 96 Operation 26.74826
## 97 97 Operation 23.76873
## 98 98 Operation 26.95642
## 99 99 Operation 22.97945
## 100 100 Operation 25.69920
## 101 101 Drugs 51.38623
## 102 102 Drugs 51.27056
## 103 103 Drugs 50.69855
## 104 104 Drugs 48.57385
## 105 105 Drugs 50.56264
## 106 106 Drugs 50.62205
## 107 107 Drugs 47.55073
## 108 108 Drugs 48.26115
## 109 109 Drugs 47.47901
## 110 110 Drugs 53.00770
## 111 111 Drugs 49.31766
## 112 112 Drugs 50.50474
## 113 113 Drugs 49.37976
## 114 114 Drugs 49.45181
## 115 115 Drugs 48.76687
## 116 116 Drugs 49.10740
## 117 117 Drugs 46.68019
## 118 118 Drugs 47.07578
## 119 119 Drugs 51.81457
## 120 120 Drugs 47.90884
## 121 121 Drugs 47.38757
## 122 122 Drugs 48.35900
## 123 123 Drugs 49.01321
## 124 124 Drugs 49.36733
## 125 125 Drugs 52.13025
## 126 126 Drugs 47.40284
## 127 127 Drugs 46.76871
## 128 128 Drugs 46.38544
## 129 129 Drugs 52.11236
## 130 130 Drugs 50.20473
## 131 131 Drugs 49.94347
## 132 132 Drugs 50.60087
## 133 133 Drugs 48.01119
## 134 134 Drugs 52.01249
## 135 135 Drugs 49.81781
## 136 136 Drugs 47.79751
## 137 137 Drugs 50.06740
## 138 138 Drugs 49.58008
## 139 139 Drugs 50.91318
## 140 140 Drugs 50.70042
## 141 141 Drugs 52.54956
## 142 142 Drugs 51.81589
## 143 143 Drugs 52.22745
## 144 144 Drugs 48.61533
## 145 145 Drugs 53.23888
## 146 146 Drugs 49.46232
## 147 147 Drugs 51.08607
## 148 148 Drugs 51.50899
## 149 149 Drugs 49.69557
## 150 150 Drugs 49.31178
## 151 151 Operation 45.73861
## 152 152 Operation 48.27009
## 154 154 Operation 49.59785
## 156 156 Operation 48.29424
## 157 157 Operation 49.66577
## 161 161 Operation 46.98132
## 162 162 Operation 49.23165
## 164 164 Operation 49.61916
## 165 165 Operation 47.75723
## 172 172 Operation 46.55345
## 173 173 Operation 47.99522
## 175 175 Operation 48.11121
## 179 179 Operation 48.62498
## 180 180 Operation 48.50661
## 182 182 Operation 45.86621
## 184 184 Operation 48.43482
## 185 185 Operation 49.51399
## 186 186 Operation 49.12689
## 188 188 Operation 47.76441
## 193 193 Operation 49.17839
## 198 198 Operation 48.23115
## 199 199 Operation 46.87365
## 200 200 Operation 48.56689
Importing datasets and analysing in R
Reading dataset
First we’ll check the current working directory in R by getwd() command
## [1] "C:/Users/asus/OneDrive/Documents"
Change current working directory by setwd() by giving path in double counts (” “) and forward slash (/); Here a important point to remember is that in windows the directories are saved in backward slash () by default, so you have to manually change it to forward slash if you copy the location in windows. Actually the R languaage has been written in keeping linux users in mind where the location is saved using forward slash.
So fisrt we’ll change our working directory to where we have downloaded wour dataset from kaggle.
setwd(“E:/Study/R data”)
Importing Datasets
for importing life expectancy data set in global environment, the argument “check.names = F” is to remove that extra X from the header
LifeExpectancyInYears <- read.csv("E:/Study/R data/life_expectancy_years.csv", header = T, check.names = F)Applying functions on the dataset
## [1] 187 302
## country 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810
## 1 Afghanistan 28.2 28.2 28.2 28.2 28.2 28.2 28.1 28.1 28.1 28.1 28.1
## 2 Albania 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 Algeria 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8
## 4 Andorra NA NA NA NA NA NA NA NA NA NA NA
## 5 Angola 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0
## 6 Antigua and Barbuda 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5
## 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825
## 1 28.1 28.1 28.1 28.1 28.1 28.1 28.0 28.0 28.0 28.0 28.0 28.0 28.0 28.0 27.9
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0
## 6 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5
## 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840
## 1 27.9 27.9 27.9 27.9 27.9 27.9 27.9 27.9 27.9 27.9 27.8 27.8 27.8 27.8 27.8
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0
## 6 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5
## 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855
## 1 27.8 27.8 27.8 27.8 27.8 27.7 27.7 27.7 27.7 27.7 27.7 27.7 27.7 27.7 27.6
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 20.0 15.0 22.0 28.8 28.8 28.8 28.8
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0
## 6 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5
## 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870
## 1 27.6 27.6 27.6 27.6 27.6 27.6 27.6 27.6 27.6 27.5 27.5 27.5 27.5 27.5 27.5
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 28.8 21.0 11.0 15.0 22.0
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0 27.0
## 6 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5 33.5
## 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885
## 1 27.6 27.6 27.7 27.8 27.8 27.9 27.9 28.0 28.1 28.1 28.2 28.3 28.3 28.4 28.5
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 28.9 28.9 29.0 29.0 29.0 29.1 29.1 29.2 29.2 29.3 29.3 29.4 29.4 29.4 29.5
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 27.1 27.1 27.2 27.3 27.3 27.4 27.5 27.5 27.6 27.7 27.7 27.8 27.9 27.9 28.0
## 6 33.5 33.5 33.6 33.6 33.6 33.6 33.6 33.6 33.6 33.6 33.6 33.6 33.6 33.6 33.6
## 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900
## 1 28.5 28.6 28.6 28.7 28.8 28.8 28.9 29.0 29.0 29.1 29.1 29.2 29.3 29.3 29.4
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 29.5 29.6 29.6 29.7 29.7 29.8 29.8 29.8 29.9 29.9 30.0 30.0 30.1 30.1 30.2
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 28.1 28.1 28.2 28.3 28.4 28.4 28.5 28.6 28.6 28.7 28.8 28.8 28.9 29.0 29.0
## 6 33.6 33.7 33.7 33.7 33.7 33.7 33.7 33.7 33.7 33.7 33.7 33.7 33.7 33.8 33.8
## 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915
## 1 29.5 29.5 29.6 29.7 29.7 29.8 29.9 29.9 30.0 30.0 30.1 30.2 30.2 30.3 30.3
## 2 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4
## 3 30.3 30.4 31.4 25.4 28.1 29.6 29.5 29.5 31.0 32.7 32.4 33.8 31.6 31.1 30.6
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 29.1 29.2 29.3 29.3 29.4 29.4 29.5 29.6 29.7 29.7 29.8 29.9 29.9 30.0 30.1
## 6 33.8 33.8 33.8 33.8 33.8 33.8 33.8 33.8 33.8 33.8 33.8 33.8 33.9 33.9 33.9
## 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930
## 1 30.4 30.5 7.97 30.6 30.6 30.7 30.8 30.8 30.9 31.0 31.0 31.1 31.1 31.2 31.3
## 2 35.4 35.4 19.40 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 35.4 36.3
## 3 30.3 30.3 23.70 30.4 29.6 29.6 29.4 32.0 33.5 34.3 33.6 28.8 32.4 32.7 34.0
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 30.1 30.2 11.70 30.4 30.4 30.5 30.6 30.6 30.7 30.8 30.8 30.9 31.0 31.0 31.1
## 6 33.9 33.9 22.00 33.9 33.9 33.9 34.8 35.6 36.4 37.3 38.1 39.0 39.8 40.7 41.5
## 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945
## 1 31.3 31.4 31.4 31.5 31.6 31.6 31.7 31.8 31.8 31.9 31.9 32.0 32.1 32.1 32.2
## 2 37.2 38.1 39.0 39.9 40.7 41.6 42.5 43.4 43.0 42.0 41.5 40.0 37.0 34.0 47.0
## 3 31.9 33.3 34.6 34.0 35.9 37.1 35.2 34.6 36.9 37.3 35.6 34.9 30.2 35.7 33.5
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 31.2 31.2 31.3 31.4 31.4 31.5 31.6 31.6 31.7 31.8 32.1 32.5 32.8 33.1 33.5
## 6 42.4 43.2 44.1 44.9 45.8 46.6 47.5 48.3 49.2 50.0 50.9 51.7 52.6 53.4 54.3
## 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
## 1 32.2 32.3 32.4 32.4 32.5 32.9 33.6 34.3 35.0 35.7 36.4 37.1 37.9 38.6 39.3
## 2 50.0 51.5 52.4 53.3 54.1 54.4 54.8 55.4 56.1 57.0 57.9 58.9 60.0 61.1 62.2
## 3 35.7 39.1 42.3 44.8 47.3 47.5 48.0 48.6 49.1 49.6 50.2 50.8 51.3 51.9 52.5
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 33.8 34.1 34.5 34.8 35.2 35.5 36.0 36.6 37.1 37.7 38.3 38.8 39.4 40.0 40.6
## 6 55.1 56.0 56.8 57.7 58.5 58.8 59.3 59.8 60.4 60.9 61.4 61.9 62.4 62.9 63.3
## 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975
## 1 40.0 40.8 41.5 42.3 43.0 43.7 44.5 45.2 45.9 46.6 46.8 46.8 46.9 47.0 47.1
## 2 63.3 64.2 64.9 65.4 65.8 66.1 66.3 66.4 66.6 66.9 67.5 68.1 68.7 69.3 69.8
## 3 53.1 53.7 54.3 54.9 55.4 56.0 56.5 57.0 57.6 58.1 58.4 58.8 59.2 59.7 60.1
## 4 NA NA NA NA NA NA NA NA NA 75.5 75.8 76.1 76.4 76.7 77.0
## 5 41.1 41.7 42.3 42.9 43.5 44.1 44.7 45.3 45.9 46.5 46.7 46.9 47.1 47.3 47.2
## 6 63.8 64.2 64.7 65.1 65.5 65.8 66.2 66.6 67.0 67.3 67.7 68.1 68.5 68.8 68.9
## 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990
## 1 47.3 47.5 45.9 44.4 44.1 44.9 44.6 42.8 40.5 42.4 43.4 45.5 47.9 51.7 52.6
## 2 70.3 70.8 71.2 71.5 71.7 71.8 72.0 72.1 72.3 72.4 72.6 72.6 72.8 73.1 73.3
## 3 60.6 61.2 61.8 62.5 62.8 64.0 65.1 66.4 67.6 68.7 69.5 70.2 70.8 71.3 71.7
## 4 77.2 77.5 77.8 78.1 78.2 78.3 78.3 78.3 78.5 78.6 78.7 78.8 78.8 78.9 79.0
## 5 47.2 47.3 47.4 47.5 47.6 47.7 47.7 47.7 47.8 47.9 47.9 47.7 47.5 47.8 47.9
## 6 69.1 69.5 69.8 70.5 71.1 71.6 72.1 72.6 72.8 73.0 73.3 73.7 73.8 74.0 74.3
## 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
## 1 52.4 52.9 53.1 52.7 53.3 53.8 53.7 52.8 54.4 54.6 54.8 55.6 56.4 56.9 57.4
## 2 73.0 73.4 73.9 74.5 74.6 74.4 72.5 74.5 74.6 74.9 75.2 75.3 75.4 75.6 76.0
## 3 72.2 72.5 72.7 72.8 72.9 73.3 73.2 73.5 73.9 74.0 74.2 74.5 74.6 75.0 75.3
## 4 79.1 79.1 79.3 79.5 79.7 80.0 80.3 80.6 80.9 81.2 81.4 81.6 81.7 81.7 81.8
## 5 48.5 48.6 47.3 48.7 49.5 50.1 50.2 49.3 50.7 51.7 52.4 53.5 54.2 54.8 55.7
## 6 74.5 74.4 74.3 74.3 74.1 74.2 74.4 74.5 74.6 74.7 74.9 75.2 75.4 75.6 75.8
## 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020
## 1 57.6 58.0 58.8 59.3 59.9 60.4 60.8 61.3 61.2 61.2 61.2 63.4 63.7 64.1 64.4
## 2 76.4 76.9 77.0 77.5 77.6 77.7 77.8 77.9 77.9 78.0 78.1 78.2 78.3 78.5 78.6
## 3 75.5 75.7 75.9 76.1 76.3 76.5 76.8 76.9 77.0 77.1 77.4 77.7 77.9 78.1 78.3
## 4 82.0 82.1 82.2 82.2 82.3 82.4 82.4 82.5 82.5 82.6 82.7 82.7 NA NA NA
## 5 56.4 57.5 58.4 59.1 59.9 60.6 61.3 61.9 62.8 63.3 63.8 64.2 64.6 65.0 65.4
## 6 76.0 76.3 76.4 76.6 76.6 76.7 76.7 76.8 76.8 76.9 77.0 77.0 77.2 77.3 77.4
## 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035
## 1 64.7 65.1 65.4 65.7 65.9 66.2 66.5 66.7 67.0 67.2 67.4 67.7 67.9 68.1 68.3
## 2 78.7 78.8 78.9 79.1 79.2 79.3 79.5 79.7 79.8 80.0 80.2 80.3 80.5 80.6 80.8
## 3 78.5 78.7 78.8 79.0 79.2 79.4 79.6 79.7 79.9 80.1 80.3 80.4 80.6 80.8 80.9
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 65.7 66.0 66.4 66.7 67.0 67.3 67.6 67.9 68.2 68.5 68.8 69.1 69.3 69.6 69.9
## 6 77.5 77.7 77.8 77.9 78.1 78.2 78.3 78.5 78.6 78.7 78.8 79.0 79.1 79.2 79.4
## 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050
## 1 68.5 68.7 68.9 69.0 69.2 69.4 69.6 69.7 69.9 70.1 70.2 70.4 70.5 70.7 70.8
## 2 80.9 81.0 81.2 81.3 81.4 81.6 81.7 81.8 82.0 82.1 82.3 82.4 82.5 82.7 82.8
## 3 81.1 81.2 81.4 81.6 81.7 81.9 82.0 82.2 82.3 82.5 82.7 82.8 83.0 83.1 83.3
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 70.1 70.4 70.6 70.8 71.1 71.3 71.5 71.7 71.9 72.1 72.3 72.5 72.7 72.8 73.0
## 6 79.5 79.6 79.7 79.9 80.0 80.1 80.3 80.4 80.5 80.6 80.8 80.9 81.0 81.1 81.3
## 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065
## 1 71.0 71.1 71.3 71.4 71.6 71.7 71.8 72.0 72.1 72.3 72.4 72.5 72.7 72.8 72.9
## 2 83.0 83.1 83.2 83.4 83.5 83.6 83.7 83.9 84.0 84.1 84.2 84.3 84.5 84.6 84.7
## 3 83.4 83.6 83.7 83.8 84.0 84.1 84.3 84.4 84.6 84.7 84.8 85.0 85.1 85.2 85.3
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 73.2 73.3 73.5 73.7 73.8 74.0 74.2 74.3 74.5 74.6 74.8 74.9 75.0 75.2 75.3
## 6 81.4 81.5 81.7 81.8 81.9 82.0 82.2 82.3 82.4 82.5 82.7 82.8 82.9 83.0 83.2
## 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080
## 1 73.1 73.2 73.3 73.5 73.6 73.7 73.9 74.0 74.2 74.3 74.4 74.6 74.7 74.8 75.0
## 2 84.8 84.9 85.0 85.1 85.2 85.3 85.4 85.5 85.7 85.8 85.8 86.0 86.0 86.2 86.3
## 3 85.5 85.6 85.7 85.8 86.0 86.1 86.2 86.3 86.4 86.5 86.7 86.8 86.9 87.0 87.1
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 75.5 75.6 75.7 75.9 76.0 76.2 76.3 76.4 76.5 76.7 76.8 77.0 77.1 77.2 77.3
## 6 83.3 83.4 83.5 83.7 83.8 83.9 84.0 84.1 84.3 84.4 84.5 84.6 84.7 84.8 84.9
## 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095
## 1 75.1 75.2 75.4 75.5 75.6 75.8 75.9 76.0 76.2 76.3 76.5 76.6 76.7 76.9 77.0
## 2 86.4 86.5 86.6 86.7 86.8 86.9 87.0 87.1 87.2 87.3 87.4 87.5 87.6 87.7 87.8
## 3 87.2 87.3 87.4 87.5 87.6 87.7 87.8 87.9 88.0 88.2 88.3 88.4 88.5 88.6 88.7
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 77.5 77.6 77.7 77.8 78.0 78.1 78.2 78.4 78.5 78.6 78.7 78.9 79.0 79.1 79.3
## 6 85.0 85.2 85.3 85.4 85.5 85.6 85.7 85.8 85.9 86.0 86.1 86.2 86.3 86.4 86.5
## 2096 2097 2098 2099 2100
## 1 77.1 77.3 77.4 77.5 77.7
## 2 87.9 88.0 88.1 88.2 88.3
## 3 88.8 88.9 89.0 89.1 89.2
## 4 NA NA NA NA NA
## 5 79.4 79.5 79.7 79.8 79.9
## 6 86.6 86.7 86.8 86.9 87.0
## 'data.frame': 187 obs. of 302 variables:
## $ country: chr "Afghanistan" "Albania" "Algeria" "Andorra" ...
## $ 1800 : num 28.2 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1801 : num 28.2 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1802 : num 28.2 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1803 : num 28.2 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1804 : num 28.2 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1805 : num 28.2 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1806 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1807 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1808 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1809 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1810 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1811 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1812 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1813 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1814 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1815 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1816 : num 28.1 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1817 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1818 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1819 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1820 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1821 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1822 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1823 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1824 : num 28 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1825 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1826 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1827 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1828 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1829 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1830 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1831 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1832 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1833 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1834 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1835 : num 27.9 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1836 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1837 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1838 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1839 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1840 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1841 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1842 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1843 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1844 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1845 : num 27.8 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1846 : num 27.7 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1847 : num 27.7 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1848 : num 27.7 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1849 : num 27.7 35.4 20 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1850 : num 27.7 35.4 15 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1851 : num 27.7 35.4 22 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1852 : num 27.7 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1853 : num 27.7 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1854 : num 27.7 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1855 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1856 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1857 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1858 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1859 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1860 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1861 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1862 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1863 : num 27.6 35.4 28.8 NA 27 33.5 33.2 34 34 34.4 ...
## $ 1864 : num 27.6 35.4 28.8 NA 27 33.5 33.2 33.5 34 34.4 ...
## $ 1865 : num 27.5 35.4 28.8 NA 27 33.5 33.2 33 34 34.4 ...
## $ 1866 : num 27.5 35.4 28.8 NA 27 33.5 33.2 32.4 34 34.4 ...
## $ 1867 : num 27.5 35.4 21 NA 27 33.5 33.2 31.9 34 34.4 ...
## $ 1868 : num 27.5 35.4 11 NA 27 33.5 33.2 31.4 34 34.4 ...
## $ 1869 : num 27.5 35.4 15 NA 27 33.5 33.2 31.4 34 34.4 ...
## $ 1870 : num 27.5 35.4 22 NA 27 33.5 33.2 31.5 34 34.4 ...
## $ 1871 : num 27.6 35.4 28.9 NA 27.1 33.5 33.2 31.5 34.6 34.5 ...
## $ 1872 : num 27.6 35.4 28.9 NA 27.1 33.5 33.2 31.5 35.1 34.5 ...
## $ 1873 : num 27.7 35.4 29 NA 27.2 33.6 33.2 31.5 35.6 34.6 ...
## $ 1874 : num 27.8 35.4 29 NA 27.3 33.6 33.2 31.7 36.2 34.6 ...
## $ 1875 : num 27.8 35.4 29 NA 27.3 33.6 33.2 31.9 36.7 34.7 ...
## $ 1876 : num 27.9 35.4 29.1 NA 27.4 33.6 33.1 32.1 37.2 34.7 ...
## $ 1877 : num 27.9 35.4 29.1 NA 27.5 33.6 33.1 32.2 37.8 34.8 ...
## $ 1878 : num 28 35.4 29.2 NA 27.5 33.6 33.1 32.4 38.3 34.9 ...
## $ 1879 : num 28.1 35.4 29.2 NA 27.6 33.6 33.1 32.6 38.8 34.9 ...
## $ 1880 : num 28.1 35.4 29.3 NA 27.7 33.6 33.1 32.8 39.4 35 ...
## $ 1881 : num 28.2 35.4 29.3 NA 27.7 33.6 33 32.9 39.9 35 ...
## $ 1882 : num 28.3 35.4 29.4 NA 27.8 33.6 32.9 33.1 40.4 35.2 ...
## $ 1883 : num 28.3 35.4 29.4 NA 27.9 33.6 32.7 33.3 41 35.5 ...
## $ 1884 : num 28.4 35.4 29.4 NA 27.9 33.6 32.6 33.5 41.5 35.7 ...
## $ 1885 : num 28.5 35.4 29.5 NA 28 33.6 32.5 33.6 42 35.9 ...
## $ 1886 : num 28.5 35.4 29.5 NA 28.1 33.6 32.8 33.8 42.5 36.2 ...
## $ 1887 : num 28.6 35.4 29.6 NA 28.1 33.7 33.1 34 43.1 36.4 ...
## $ 1888 : num 28.6 35.4 29.6 NA 28.2 33.7 33.4 34.2 43.6 36.6 ...
## $ 1889 : num 28.7 35.4 29.7 NA 28.3 33.7 33.6 34.3 44.1 36.9 ...
## $ 1890 : num 28.8 35.4 29.7 NA 28.4 33.7 33.9 34.5 44.7 37.1 ...
## $ 1891 : num 28.8 35.4 29.8 NA 28.4 33.7 33.8 34.7 45.2 37.3 ...
## $ 1892 : num 28.9 35.4 29.8 NA 28.5 33.7 33.6 34.9 45.7 37.8 ...
## $ 1893 : num 29 35.4 29.8 NA 28.6 33.7 33.5 35 46.3 38.3 ...
## $ 1894 : num 29 35.4 29.9 NA 28.6 33.7 33.3 35.2 46.8 38.7 ...
## $ 1895 : num 29.1 35.4 29.9 NA 28.7 33.7 33.2 35.4 47.3 39.2 ...
## $ 1896 : num 29.1 35.4 30 NA 28.8 33.7 33.9 35.5 47.9 39.7 ...
## $ 1897 : num 29.2 35.4 30 NA 28.8 33.7 34.6 35.7 48.4 40.2 ...
## [list output truncated]
## country 1800 1801 1802
## Length:187 Min. :23.40 Min. :23.40 Min. :23.40
## Class :character 1st Qu.:29.07 1st Qu.:28.98 1st Qu.:28.90
## Mode :character Median :31.75 Median :31.65 Median :31.55
## Mean :31.50 Mean :31.46 Mean :31.48
## 3rd Qu.:33.83 3rd Qu.:33.90 3rd Qu.:33.83
## Max. :42.90 Max. :40.30 Max. :44.40
## NA's :3 NA's :3 NA's :3
## 1803 1804 1805 1806
## Min. :19.60 Min. :23.40 Min. :23.40 Min. :23.40
## 1st Qu.:28.90 1st Qu.:28.98 1st Qu.:29.07 1st Qu.:29.07
## Median :31.50 Median :31.55 Median :31.65 Median :31.75
## Mean :31.38 Mean :31.46 Mean :31.59 Mean :31.64
## 3rd Qu.:33.62 3rd Qu.:33.73 3rd Qu.:33.83 3rd Qu.:33.92
## Max. :44.80 Max. :42.80 Max. :44.30 Max. :45.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1807 1808 1809 1810
## Min. :23.40 Min. :12.50 Min. :13.40 Min. :23.40
## 1st Qu.:29.07 1st Qu.:28.98 1st Qu.:28.88 1st Qu.:29.07
## Median :31.75 Median :31.55 Median :31.50 Median :31.75
## Mean :31.60 Mean :31.38 Mean :31.31 Mean :31.54
## 3rd Qu.:33.92 3rd Qu.:33.73 3rd Qu.:33.62 3rd Qu.:33.83
## Max. :43.60 Max. :43.50 Max. :41.70 Max. :43.10
## NA's :3 NA's :3 NA's :3 NA's :3
## 1811 1812 1813 1814
## Min. :23.40 Min. :23.00 Min. :23.40 Min. :23.40
## 1st Qu.:29.07 1st Qu.:29.07 1st Qu.:29.07 1st Qu.:29.07
## Median :31.65 Median :31.70 Median :31.65 Median :31.65
## Mean :31.50 Mean :31.49 Mean :31.48 Mean :31.54
## 3rd Qu.:33.83 3rd Qu.:33.83 3rd Qu.:33.73 3rd Qu.:33.92
## Max. :40.10 Max. :43.50 Max. :43.00 Max. :41.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 1815 1816 1817 1818
## Min. :23.40 Min. :23.40 Min. :23.40 Min. : 5.50
## 1st Qu.:29.07 1st Qu.:29.07 1st Qu.:29.07 1st Qu.:29.07
## Median :31.75 Median :31.65 Median :31.75 Median :31.75
## Mean :31.68 Mean :31.66 Mean :31.76 Mean :31.60
## 3rd Qu.:34.00 3rd Qu.:33.92 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :45.60 Max. :46.30 Max. :48.90 Max. :46.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1819 1820 1821 1822
## Min. : 1.50 Min. : 6.50 Min. :23.40 Min. :23.40
## 1st Qu.:29.07 1st Qu.:29.15 1st Qu.:29.15 1st Qu.:29.15
## Median :31.75 Median :31.75 Median :31.65 Median :31.80
## Mean :31.50 Mean :31.58 Mean :31.65 Mean :31.76
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:33.92 3rd Qu.:34.00
## Max. :45.80 Max. :47.00 Max. :44.70 Max. :48.40
## NA's :3 NA's :3 NA's :3 NA's :3
## 1823 1824 1825 1826
## Min. :23.40 Min. :23.40 Min. :23.40 Min. :23.40
## 1st Qu.:29.15 1st Qu.:29.15 1st Qu.:29.15 1st Qu.:28.98
## Median :31.80 Median :31.80 Median :31.80 Median :31.75
## Mean :31.81 Mean :31.75 Mean :31.70 Mean :31.62
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :48.80 Max. :47.60 Max. :49.20 Max. :47.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 1827 1828 1829 1830
## Min. :23.40 Min. :23.40 Min. :23.40 Min. :23.40
## 1st Qu.:28.98 1st Qu.:28.98 1st Qu.:29.15 1st Qu.:29.15
## Median :31.75 Median :31.75 Median :31.75 Median :31.85
## Mean :31.66 Mean :31.60 Mean :31.58 Mean :31.67
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :48.40 Max. :46.20 Max. :46.30 Max. :45.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1831 1832 1833 1834
## Min. :23.40 Min. :23.00 Min. :20.40 Min. :23.40
## 1st Qu.:29.15 1st Qu.:29.15 1st Qu.:29.15 1st Qu.:29.15
## Median :31.80 Median :31.75 Median :31.80 Median :31.80
## Mean :31.63 Mean :31.59 Mean :31.59 Mean :31.57
## 3rd Qu.:34.00 3rd Qu.:33.92 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :45.70 Max. :47.60 Max. :44.90 Max. :42.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 1835 1836 1837 1838
## Min. :23.40 Min. :23.40 Min. :23.40 Min. :23.40
## 1st Qu.:28.98 1st Qu.:29.15 1st Qu.:28.98 1st Qu.:29.15
## Median :31.80 Median :31.65 Median :31.80 Median :31.85
## Mean :31.71 Mean :31.67 Mean :31.61 Mean :31.67
## 3rd Qu.:34.00 3rd Qu.:33.92 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :47.10 Max. :46.50 Max. :44.20 Max. :43.10
## NA's :3 NA's :3 NA's :3 NA's :3
## 1839 1840 1841 1842
## Min. :23.40 Min. :23.40 Min. :23.00 Min. :22.40
## 1st Qu.:28.98 1st Qu.:29.20 1st Qu.:29.15 1st Qu.:29.15
## Median :31.80 Median :31.90 Median :31.85 Median :31.85
## Mean :31.66 Mean :31.75 Mean :31.80 Mean :31.77
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.05 3rd Qu.:34.05
## Max. :43.00 Max. :45.60 Max. :49.50 Max. :48.40
## NA's :3 NA's :3 NA's :3 NA's :3
## 1843 1844 1845 1846
## Min. :23.40 Min. :15.00 Min. :23.40 Min. :18.30
## 1st Qu.:28.98 1st Qu.:29.15 1st Qu.:29.15 1st Qu.:28.98
## Median :31.80 Median :31.85 Median :31.85 Median :31.75
## Mean :31.76 Mean :31.82 Mean :31.88 Mean :31.57
## 3rd Qu.:34.00 3rd Qu.:34.05 3rd Qu.:34.05 3rd Qu.:34.00
## Max. :48.40 Max. :49.70 Max. :50.10 Max. :48.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 1847 1848 1849 1850
## Min. :23.40 Min. :14.90 Min. :14.10 Min. :14.00
## 1st Qu.:29.15 1st Qu.:28.98 1st Qu.:29.15 1st Qu.:29.20
## Median :31.85 Median :31.85 Median :31.80 Median :31.80
## Mean :31.65 Mean :31.64 Mean :31.48 Mean :31.67
## 3rd Qu.:34.00 3rd Qu.:34.05 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :44.80 Max. :45.10 Max. :48.00 Max. :49.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 1851 1852 1853 1854
## Min. :22.00 Min. :23.40 Min. :23.40 Min. : 7.50
## 1st Qu.:29.20 1st Qu.:29.20 1st Qu.:29.15 1st Qu.:28.90
## Median :31.80 Median :31.85 Median :31.85 Median :31.80
## Mean :31.82 Mean :31.83 Mean :31.83 Mean :31.70
## 3rd Qu.:34.05 3rd Qu.:34.05 3rd Qu.:34.00 3rd Qu.:34.05
## Max. :49.70 Max. :48.50 Max. :48.60 Max. :51.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 1855 1856 1857 1858
## Min. :23.40 Min. :17.60 Min. :23.40 Min. :23.40
## 1st Qu.:28.98 1st Qu.:28.98 1st Qu.:29.15 1st Qu.:29.15
## Median :31.80 Median :31.75 Median :31.80 Median :31.85
## Mean :31.74 Mean :31.75 Mean :31.76 Mean :31.76
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.05 3rd Qu.:34.05
## Max. :50.40 Max. :50.40 Max. :50.20 Max. :51.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 1859 1860 1861 1862
## Min. :23.40 Min. :19.80 Min. :22.00 Min. :22.70
## 1st Qu.:29.15 1st Qu.:28.98 1st Qu.:29.15 1st Qu.:28.98
## Median :31.70 Median :31.75 Median :31.75 Median :31.75
## Mean :31.73 Mean :31.81 Mean :31.77 Mean :31.70
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00
## Max. :49.90 Max. :50.00 Max. :47.60 Max. :47.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 1863 1864 1865 1866
## Min. :23.40 Min. :23.20 Min. :22.30 Min. :21.00
## 1st Qu.:29.15 1st Qu.:28.90 1st Qu.:28.90 1st Qu.:28.88
## Median :31.80 Median :31.70 Median :31.70 Median :31.65
## Mean :31.76 Mean :31.69 Mean :31.65 Mean :31.52
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:33.73
## Max. :47.60 Max. :48.80 Max. :50.40 Max. :49.90
## NA's :3 NA's :3 NA's :3 NA's :3
## 1867 1868 1869 1870
## Min. : 4.00 Min. : 8.11 Min. :15.00 Min. :19.90
## 1st Qu.:28.90 1st Qu.:28.88 1st Qu.:28.88 1st Qu.:29.15
## Median :31.70 Median :31.55 Median :31.55 Median :31.75
## Mean :31.53 Mean :31.25 Mean :31.57 Mean :31.82
## 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.00 3rd Qu.:34.25
## Max. :47.90 Max. :47.20 Max. :49.30 Max. :50.90
## NA's :3 NA's :3 NA's :3 NA's :3
## 1871 1872 1873 1874
## Min. :20.00 Min. :20.00 Min. :20.10 Min. :20.30
## 1st Qu.:29.15 1st Qu.:29.00 1st Qu.:29.20 1st Qu.:29.48
## Median :31.65 Median :31.70 Median :31.70 Median :31.80
## Mean :31.76 Mean :31.85 Mean :31.95 Mean :32.01
## 3rd Qu.:34.25 3rd Qu.:34.60 3rd Qu.:34.70 3rd Qu.:34.70
## Max. :49.70 Max. :50.10 Max. :49.70 Max. :47.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1875 1876 1877 1878
## Min. : 1.01 Min. :20.00 Min. :19.00 Min. :20.00
## 1st Qu.:29.48 1st Qu.:29.50 1st Qu.:29.50 1st Qu.:29.50
## Median :31.75 Median :31.80 Median :31.85 Median :31.90
## Mean :31.90 Mean :32.11 Mean :32.20 Mean :32.21
## 3rd Qu.:35.02 3rd Qu.:34.85 3rd Qu.:34.92 3rd Qu.:35.00
## Max. :47.60 Max. :46.80 Max. :49.80 Max. :51.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1879 1880 1881 1882
## Min. :21.20 Min. :21.40 Min. :21.60 Min. :17.70
## 1st Qu.:29.60 1st Qu.:29.68 1st Qu.:29.75 1st Qu.:29.50
## Median :31.95 Median :32.00 Median :32.05 Median :32.00
## Mean :32.34 Mean :32.35 Mean :32.41 Mean :32.37
## 3rd Qu.:35.02 3rd Qu.:35.02 3rd Qu.:35.02 3rd Qu.:35.12
## Max. :53.20 Max. :51.90 Max. :50.50 Max. :48.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 1883 1884 1885 1886
## Min. :22.00 Min. :22.20 Min. :22.40 Min. :22.60
## 1st Qu.:29.70 1st Qu.:29.95 1st Qu.:29.80 1st Qu.:30.05
## Median :32.00 Median :32.05 Median :32.10 Median :32.15
## Mean :32.53 Mean :32.69 Mean :32.76 Mean :32.83
## 3rd Qu.:35.20 3rd Qu.:35.23 3rd Qu.:35.33 3rd Qu.:35.33
## Max. :49.60 Max. :50.80 Max. :51.00 Max. :51.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 1887 1888 1889 1890
## Min. :22.80 Min. :17.00 Min. : 5.00 Min. : 4.00
## 1st Qu.:29.88 1st Qu.:30.12 1st Qu.:29.95 1st Qu.:29.90
## Median :32.10 Median :32.20 Median :32.15 Median :32.15
## Mean :32.89 Mean :32.94 Mean :32.93 Mean :32.71
## 3rd Qu.:35.42 3rd Qu.:35.42 3rd Qu.:35.50 3rd Qu.:35.42
## Max. :51.70 Max. :52.30 Max. :52.50 Max. :50.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 1891 1892 1893 1894
## Min. : 8.00 Min. :14.00 Min. : 8.08 Min. :21.80
## 1st Qu.:30.10 1st Qu.:30.05 1st Qu.:29.98 1st Qu.:30.00
## Median :32.20 Median :32.20 Median :32.20 Median :32.35
## Mean :32.92 Mean :32.94 Mean :33.01 Mean :33.25
## 3rd Qu.:35.52 3rd Qu.:35.42 3rd Qu.:35.42 3rd Qu.:35.45
## Max. :51.10 Max. :52.70 Max. :52.60 Max. :52.10
## NA's :3 NA's :3 NA's :3 NA's :3
## 1895 1896 1897 1898
## Min. :21.60 Min. :19.60 Min. :18.60 Min. :19.90
## 1st Qu.:29.98 1st Qu.:30.00 1st Qu.:30.07 1st Qu.:30.05
## Median :32.30 Median :32.35 Median :32.40 Median :32.45
## Mean :33.34 Mean :33.44 Mean :33.52 Mean :33.57
## 3rd Qu.:35.60 3rd Qu.:35.60 3rd Qu.:35.60 3rd Qu.:35.60
## Max. :54.10 Max. :53.80 Max. :54.10 Max. :54.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 1899 1900 1901 1902
## Min. :19.10 Min. :18.40 Min. :21.20 Min. :12.90
## 1st Qu.:30.05 1st Qu.:30.20 1st Qu.:30.15 1st Qu.:30.05
## Median :32.50 Median :32.55 Median :32.65 Median :32.65
## Mean :33.55 Mean :33.61 Mean :33.80 Mean :33.90
## 3rd Qu.:35.62 3rd Qu.:35.62 3rd Qu.:35.62 3rd Qu.:35.70
## Max. :51.60 Max. :53.40 Max. :54.50 Max. :56.40
## NA's :3 NA's :3 NA's :3 NA's :3
## 1903 1904 1905 1906
## Min. :20.30 Min. : 5.19 Min. :10.40 Min. :20.30
## 1st Qu.:30.10 1st Qu.:30.18 1st Qu.:30.27 1st Qu.:30.10
## Median :32.75 Median :32.80 Median :32.75 Median :32.65
## Mean :33.95 Mean :33.99 Mean :34.04 Mean :34.18
## 3rd Qu.:35.73 3rd Qu.:35.73 3rd Qu.:35.80 3rd Qu.:35.73
## Max. :55.10 Max. :56.00 Max. :55.00 Max. :56.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1907 1908 1909 1910
## Min. :18.10 Min. :21.20 Min. :21.40 Min. :21.50
## 1st Qu.:30.18 1st Qu.:30.40 1st Qu.:30.68 1st Qu.:30.68
## Median :32.75 Median :32.90 Median :32.85 Median :32.90
## Mean :34.30 Mean :34.42 Mean :34.68 Mean :34.83
## 3rd Qu.:35.73 3rd Qu.:35.83 3rd Qu.:35.83 3rd Qu.:35.83
## Max. :57.00 Max. :56.40 Max. :58.40 Max. :58.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 1911 1912 1913 1914
## Min. :21.70 Min. :21.80 Min. :22.00 Min. :22.10
## 1st Qu.:30.77 1st Qu.:30.70 1st Qu.:30.70 1st Qu.:30.57
## Median :33.05 Median :33.15 Median :32.95 Median :32.90
## Mean :34.96 Mean :35.19 Mean :35.22 Mean :34.96
## 3rd Qu.:36.02 3rd Qu.:36.10 3rd Qu.:36.12 3rd Qu.:36.12
## Max. :58.00 Max. :58.00 Max. :58.90 Max. :58.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 1915 1916 1917 1918 1919
## Min. : 7.21 Min. :19.60 Min. :20.10 Min. : 1.10 Min. :11.8
## 1st Qu.:30.60 1st Qu.:30.60 1st Qu.:30.40 1st Qu.:13.20 1st Qu.:30.6
## Median :33.00 Median :33.00 Median :32.90 Median :22.00 Median :33.1
## Mean :34.59 Mean :34.71 Mean :34.55 Mean :22.95 Mean :34.7
## 3rd Qu.:35.92 3rd Qu.:35.92 3rd Qu.:35.73 3rd Qu.:29.18 3rd Qu.:35.9
## Max. :58.40 Max. :58.50 Max. :59.00 Max. :56.20 Max. :60.1
## NA's :3 NA's :3 NA's :3 NA's :3 NA's :3
## 1920 1921 1922 1923
## Min. :15.20 Min. :11.90 Min. :13.90 Min. :23.40
## 1st Qu.:30.48 1st Qu.:30.57 1st Qu.:30.75 1st Qu.:31.20
## Median :32.90 Median :33.05 Median :33.55 Median :33.70
## Mean :34.96 Mean :35.44 Mean :35.77 Mean :36.52
## 3rd Qu.:35.90 3rd Qu.:36.33 3rd Qu.:36.73 3rd Qu.:37.92
## Max. :60.60 Max. :61.70 Max. :63.00 Max. :63.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 1924 1925 1926 1927
## Min. :23.60 Min. :23.60 Min. :23.60 Min. :23.60
## 1st Qu.:31.27 1st Qu.:31.27 1st Qu.:31.40 1st Qu.:31.45
## Median :33.90 Median :34.05 Median :34.25 Median :34.35
## Mean :36.81 Mean :36.99 Mean :37.38 Mean :37.54
## 3rd Qu.:38.62 3rd Qu.:39.30 3rd Qu.:40.02 3rd Qu.:40.65
## Max. :63.00 Max. :63.30 Max. :63.10 Max. :63.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 1928 1929 1930 1931
## Min. :23.60 Min. :23.60 Min. :23.70 Min. :16.30
## 1st Qu.:31.57 1st Qu.:31.60 1st Qu.:31.90 1st Qu.:31.85
## Median :34.40 Median :34.50 Median :34.65 Median :34.50
## Mean :37.86 Mean :37.88 Mean :38.37 Mean :38.35
## 3rd Qu.:41.27 3rd Qu.:41.70 3rd Qu.:42.42 3rd Qu.:43.12
## Max. :63.80 Max. :63.30 Max. :65.10 Max. :65.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 1932 1933 1934 1935
## Min. : 8.15 Min. : 4.07 Min. :23.70 Min. :23.70
## 1st Qu.:31.85 1st Qu.:31.68 1st Qu.:32.40 1st Qu.:32.48
## Median :34.60 Median :34.70 Median :35.75 Median :36.35
## Mean :38.34 Mean :38.13 Mean :39.67 Mean :40.07
## 3rd Qu.:43.55 3rd Qu.:44.10 3rd Qu.:44.90 3rd Qu.:46.12
## Max. :65.80 Max. :66.20 Max. :66.70 Max. :66.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 1936 1937 1938 1939
## Min. :23.00 Min. :23.70 Min. :23.70 Min. :23.70
## 1st Qu.:33.08 1st Qu.:33.30 1st Qu.:33.45 1st Qu.:33.73
## Median :36.75 Median :36.80 Median :37.25 Median :38.10
## Mean :40.56 Mean :40.88 Mean :41.40 Mean :41.87
## 3rd Qu.:47.23 3rd Qu.:47.75 3rd Qu.:48.55 3rd Qu.:49.33
## Max. :66.80 Max. :67.10 Max. :67.50 Max. :67.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1940 1941 1942 1943
## Min. :23.70 Min. :12.00 Min. :14.90 Min. :13.90
## 1st Qu.:33.75 1st Qu.:32.90 1st Qu.:32.50 1st Qu.:32.48
## Median :38.40 Median :36.70 Median :36.60 Median :37.15
## Mean :41.82 Mean :40.34 Mean :40.14 Mean :39.91
## 3rd Qu.:49.35 3rd Qu.:47.02 3rd Qu.:48.15 3rd Qu.:47.90
## Max. :66.70 Max. :67.00 Max. :68.90 Max. :68.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 1944 1945 1946 1947
## Min. :15.40 Min. :15.90 Min. :22.30 Min. :11.10
## 1st Qu.:32.60 1st Qu.:33.90 1st Qu.:35.77 1st Qu.:37.00
## Median :36.45 Median :38.90 Median :44.50 Median :43.40
## Mean :39.72 Mean :41.55 Mean :45.14 Mean :45.67
## 3rd Qu.:46.45 3rd Qu.:47.17 3rd Qu.:53.70 3rd Qu.:54.23
## Max. :68.20 Max. :68.60 Max. :69.50 Max. :69.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 1948 1949 1950 1951
## Min. :23.70 Min. :23.80 Min. :23.80 Min. :24.20
## 1st Qu.:38.27 1st Qu.:39.42 1st Qu.:40.77 1st Qu.:40.92
## Median :47.35 Median :48.75 Median :50.00 Median :50.25
## Mean :47.83 Mean :48.96 Mean :50.08 Mean :50.29
## 3rd Qu.:56.85 3rd Qu.:58.00 3rd Qu.:58.95 3rd Qu.:59.48
## Max. :71.20 Max. :71.40 Max. :71.60 Max. :72.30
## NA's :3 NA's :3 NA's :3 NA's :3
## 1952 1953 1954 1955
## Min. :25.20 Min. :26.20 Min. :27.10 Min. :28.10
## 1st Qu.:41.17 1st Qu.:41.83 1st Qu.:42.38 1st Qu.:43.00
## Median :50.70 Median :51.30 Median :52.05 Median :52.65
## Mean :50.90 Mean :51.54 Mean :52.22 Mean :52.80
## 3rd Qu.:59.92 3rd Qu.:60.98 3rd Qu.:61.35 3rd Qu.:61.92
## Max. :72.50 Max. :73.00 Max. :73.30 Max. :73.30
## NA's :3 NA's :3 NA's :3 NA's :3
## 1956 1957 1958 1959
## Min. :29.10 Min. :30.10 Min. :31.00 Min. :32.00
## 1st Qu.:43.60 1st Qu.:44.30 1st Qu.:45.08 1st Qu.:45.42
## Median :53.80 Median :54.45 Median :55.00 Median :55.45
## Mean :53.33 Mean :53.80 Mean :54.42 Mean :54.86
## 3rd Qu.:62.45 3rd Qu.:63.15 3rd Qu.:63.90 3rd Qu.:64.12
## Max. :73.30 Max. :73.40 Max. :73.40 Max. :73.30
## NA's :3 NA's :3 NA's :3 NA's :3
## 1960 1961 1962 1963
## Min. :31.60 Min. :33.90 Min. :34.50 Min. :34.90
## 1st Qu.:45.98 1st Qu.:46.40 1st Qu.:46.75 1st Qu.:47.27
## Median :55.90 Median :56.35 Median :56.80 Median :57.45
## Mean :55.41 Mean :55.93 Mean :56.40 Mean :56.92
## 3rd Qu.:64.62 3rd Qu.:65.00 3rd Qu.:65.33 3rd Qu.:65.65
## Max. :74.00 Max. :73.70 Max. :73.60 Max. :73.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 1964 1965 1966 1967
## Min. :35.30 Min. :35.80 Min. :36.50 Min. :37.20
## 1st Qu.:47.67 1st Qu.:48.17 1st Qu.:48.60 1st Qu.:49.50
## Median :58.15 Median :58.90 Median :59.95 Median :60.90
## Mean :57.46 Mean :57.86 Mean :58.32 Mean :58.77
## 3rd Qu.:66.05 3rd Qu.:66.50 3rd Qu.:66.92 3rd Qu.:67.42
## Max. :73.90 Max. :73.80 Max. :74.10 Max. :74.10
## NA's :3 NA's :3 NA's :3 NA's :3
## 1968 1969 1970 1971
## Min. :38.00 Min. :36.90 Min. :39.70 Min. :39.90
## 1st Qu.:50.23 1st Qu.:50.58 1st Qu.:51.65 1st Qu.:52.20
## Median :61.40 Median :61.70 Median :62.30 Median :63.00
## Mean :59.14 Mean :59.51 Mean :60.16 Mean :60.59
## 3rd Qu.:67.92 3rd Qu.:68.25 3rd Qu.:68.80 3rd Qu.:68.95
## Max. :74.00 Max. :74.10 Max. :75.50 Max. :75.80
## NA's :3 NA's :3
## 1972 1973 1974 1975
## Min. :18.50 Min. :40.50 Min. :38.90 Min. :24.90
## 1st Qu.:52.45 1st Qu.:53.25 1st Qu.:53.70 1st Qu.:54.30
## Median :63.40 Median :63.50 Median :63.90 Median :64.50
## Mean :60.82 Mean :61.22 Mean :61.62 Mean :61.95
## 3rd Qu.:69.30 3rd Qu.:69.25 3rd Qu.:69.35 3rd Qu.:69.70
## Max. :76.10 Max. :76.40 Max. :76.70 Max. :77.00
##
## 1976 1977 1978 1979
## Min. :24.80 Min. :24.60 Min. :24.30 Min. :24.10
## 1st Qu.:54.55 1st Qu.:55.10 1st Qu.:55.40 1st Qu.:56.05
## Median :64.60 Median :65.20 Median :65.50 Median :66.20
## Mean :62.18 Mean :62.66 Mean :62.93 Mean :63.22
## 3rd Qu.:69.85 3rd Qu.:70.10 3rd Qu.:70.40 3rd Qu.:70.60
## Max. :77.20 Max. :77.50 Max. :77.80 Max. :78.10
##
## 1980 1981 1982 1983
## Min. :43.40 Min. :43.20 Min. :43.70 Min. :41.40
## 1st Qu.:56.05 1st Qu.:56.25 1st Qu.:56.25 1st Qu.:57.25
## Median :66.50 Median :66.70 Median :66.80 Median :67.40
## Mean :63.74 Mean :63.95 Mean :64.05 Mean :64.47
## 3rd Qu.:70.75 3rd Qu.:71.00 3rd Qu.:71.15 3rd Qu.:71.25
## Max. :78.20 Max. :78.30 Max. :78.30 Max. :78.30
##
## 1984 1985 1986 1987
## Min. :40.50 Min. :42.40 Min. :43.40 Min. :44.80
## 1st Qu.:57.85 1st Qu.:58.25 1st Qu.:58.65 1st Qu.:58.65
## Median :67.80 Median :68.10 Median :68.60 Median :68.90
## Mean :64.73 Mean :65.00 Mean :65.36 Mean :65.53
## 3rd Qu.:71.30 3rd Qu.:71.55 3rd Qu.:71.75 3rd Qu.:71.85
## Max. :78.50 Max. :78.60 Max. :78.70 Max. :78.80
##
## 1988 1989 1990 1991
## Min. :45.40 Min. :46.00 Min. :46.60 Min. :46.90
## 1st Qu.:58.65 1st Qu.:59.45 1st Qu.:59.95 1st Qu.:60.05
## Median :68.90 Median :69.60 Median :69.50 Median :69.70
## Mean :65.66 Mean :66.07 Mean :66.19 Mean :66.30
## 3rd Qu.:71.95 3rd Qu.:71.90 3rd Qu.:72.15 3rd Qu.:72.50
## Max. :78.90 Max. :79.10 Max. :79.30 Max. :79.40
##
## 1992 1993 1994 1995
## Min. :46.50 Min. :46.10 Min. : 9.64 Min. :44.30
## 1st Qu.:60.15 1st Qu.:60.20 1st Qu.:60.60 1st Qu.:60.35
## Median :69.40 Median :69.20 Median :69.50 Median :69.40
## Mean :66.36 Mean :66.37 Mean :66.23 Mean :66.48
## 3rd Qu.:72.60 3rd Qu.:72.80 3rd Qu.:73.10 3rd Qu.:73.30
## Max. :79.50 Max. :79.70 Max. :80.10 Max. :80.00
##
## 1996 1997 1998 1999
## Min. :43.90 Min. :43.60 Min. :44.30 Min. :43.40
## 1st Qu.:60.15 1st Qu.:60.20 1st Qu.:60.15 1st Qu.:59.95
## Median :70.10 Median :70.40 Median :70.60 Median :70.70
## Mean :66.69 Mean :66.82 Mean :66.98 Mean :67.14
## 3rd Qu.:73.40 3rd Qu.:73.75 3rd Qu.:73.80 3rd Qu.:74.05
## Max. :80.50 Max. :80.80 Max. :80.80 Max. :81.00
##
## 2000 2001 2002 2003
## Min. :44.30 Min. :44.30 Min. :44.40 Min. :44.50
## 1st Qu.:60.55 1st Qu.:61.00 1st Qu.:61.35 1st Qu.:61.55
## Median :71.10 Median :71.10 Median :71.30 Median :72.00
## Mean :67.49 Mean :67.77 Mean :67.97 Mean :68.26
## 3rd Qu.:74.50 3rd Qu.:74.80 3rd Qu.:74.95 3rd Qu.:75.15
## Max. :81.40 Max. :81.70 Max. :82.00 Max. :82.10
##
## 2004 2005 2006 2007
## Min. :43.90 Min. :43.60 Min. :43.90 Min. :44.20
## 1st Qu.:61.60 1st Qu.:61.70 1st Qu.:62.05 1st Qu.:62.45
## Median :71.90 Median :72.20 Median :72.60 Median :72.60
## Mean :68.51 Mean :68.84 Mean :69.19 Mean :69.54
## 3rd Qu.:75.50 3rd Qu.:75.60 3rd Qu.:76.00 3rd Qu.:76.30
## Max. :82.30 Max. :82.30 Max. :82.60 Max. :82.80
##
## 2008 2009 2010 2011
## Min. :44.50 Min. :44.90 Min. :32.50 Min. :48.00
## 1st Qu.:62.70 1st Qu.:63.30 1st Qu.:63.90 1st Qu.:64.20
## Median :72.80 Median :72.90 Median :73.30 Median :73.40
## Mean :69.85 Mean :70.21 Mean :70.48 Mean :70.91
## 3rd Qu.:76.45 3rd Qu.:76.75 3rd Qu.:77.00 3rd Qu.:77.15
## Max. :82.90 Max. :83.10 Max. :83.20 Max. :83.40
##
## 2012 2013 2014 2015
## Min. :48.90 Min. :48.50 Min. :48.70 Min. :50.50
## 1st Qu.:65.00 1st Qu.:65.45 1st Qu.:65.95 1st Qu.:66.95
## Median :73.20 Median :73.10 Median :73.10 Median :73.30
## Mean :71.31 Mean :71.64 Mean :71.87 Mean :72.14
## 3rd Qu.:77.45 3rd Qu.:77.60 3rd Qu.:77.75 3rd Qu.:77.85
## Max. :83.60 Max. :83.90 Max. :84.20 Max. :84.40
##
## 2016 2017 2018 2019
## Min. :51.70 Min. :51.90 Min. :52.40 Min. :52.90
## 1st Qu.:67.30 1st Qu.:67.80 1st Qu.:68.10 1st Qu.:68.28
## Median :73.70 Median :74.00 Median :74.15 Median :74.20
## Mean :72.45 Mean :72.74 Mean :72.97 Mean :73.18
## 3rd Qu.:78.05 3rd Qu.:78.15 3rd Qu.:78.33 3rd Qu.:78.50
## Max. :84.70 Max. :84.80 Max. :85.00 Max. :85.10
## NA's :3 NA's :3
## 2020 2021 2022 2023
## Min. :53.30 Min. :53.60 Min. :53.90 Min. :54.20
## 1st Qu.:68.47 1st Qu.:68.72 1st Qu.:69.00 1st Qu.:69.20
## Median :74.35 Median :74.50 Median :74.65 Median :74.95
## Mean :73.39 Mean :73.59 Mean :73.78 Mean :73.97
## 3rd Qu.:78.60 3rd Qu.:78.72 3rd Qu.:78.90 3rd Qu.:79.00
## Max. :85.30 Max. :85.40 Max. :85.50 Max. :85.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 2024 2025 2026 2027
## Min. :54.50 Min. :54.80 Min. :55.10 Min. :55.40
## 1st Qu.:69.35 1st Qu.:69.50 1st Qu.:69.67 1st Qu.:69.97
## Median :75.10 Median :75.25 Median :75.40 Median :75.50
## Mean :74.16 Mean :74.34 Mean :74.52 Mean :74.72
## 3rd Qu.:79.12 3rd Qu.:79.30 3rd Qu.:79.40 3rd Qu.:79.60
## Max. :85.80 Max. :85.90 Max. :86.00 Max. :86.20
## NA's :3 NA's :3 NA's :3 NA's :3
## 2028 2029 2030 2031
## Min. :55.70 Min. :56.00 Min. :56.30 Min. :56.60
## 1st Qu.:70.28 1st Qu.:70.50 1st Qu.:70.70 1st Qu.:70.95
## Median :75.70 Median :75.80 Median :75.95 Median :76.10
## Mean :74.90 Mean :75.09 Mean :75.27 Mean :75.44
## 3rd Qu.:79.72 3rd Qu.:79.92 3rd Qu.:80.10 3rd Qu.:80.30
## Max. :86.30 Max. :86.40 Max. :86.50 Max. :86.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 2032 2033 2034 2035
## Min. :56.90 Min. :57.20 Min. :57.40 Min. :57.70
## 1st Qu.:71.20 1st Qu.:71.30 1st Qu.:71.47 1st Qu.:71.60
## Median :76.30 Median :76.45 Median :76.65 Median :76.75
## Mean :75.62 Mean :75.79 Mean :75.96 Mean :76.13
## 3rd Qu.:80.50 3rd Qu.:80.65 3rd Qu.:80.83 3rd Qu.:80.95
## Max. :86.80 Max. :86.90 Max. :87.00 Max. :87.10
## NA's :3 NA's :3 NA's :3 NA's :3
## 2036 2037 2038 2039
## Min. :58.00 Min. :58.30 Min. :58.50 Min. :58.80
## 1st Qu.:71.83 1st Qu.:71.95 1st Qu.:72.17 1st Qu.:72.30
## Median :76.90 Median :77.05 Median :77.20 Median :77.30
## Mean :76.30 Mean :76.46 Mean :76.61 Mean :76.78
## 3rd Qu.:81.12 3rd Qu.:81.33 3rd Qu.:81.42 3rd Qu.:81.60
## Max. :87.30 Max. :87.40 Max. :87.50 Max. :87.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 2040 2041 2042 2043
## Min. :59.00 Min. :59.30 Min. :59.50 Min. :59.70
## 1st Qu.:72.40 1st Qu.:72.67 1st Qu.:72.88 1st Qu.:73.08
## Median :77.40 Median :77.55 Median :77.70 Median :77.85
## Mean :76.93 Mean :77.09 Mean :77.25 Mean :77.40
## 3rd Qu.:81.72 3rd Qu.:81.90 3rd Qu.:82.03 3rd Qu.:82.20
## Max. :87.70 Max. :87.80 Max. :88.00 Max. :88.10
## NA's :3 NA's :3 NA's :3 NA's :3
## 2044 2045 2046 2047
## Min. :60.00 Min. :60.20 Min. :60.40 Min. :60.60
## 1st Qu.:73.20 1st Qu.:73.30 1st Qu.:73.50 1st Qu.:73.60
## Median :77.95 Median :78.15 Median :78.30 Median :78.45
## Mean :77.55 Mean :77.70 Mean :77.85 Mean :78.00
## 3rd Qu.:82.30 3rd Qu.:82.50 3rd Qu.:82.62 3rd Qu.:82.80
## Max. :88.20 Max. :88.30 Max. :88.50 Max. :88.60
## NA's :3 NA's :3 NA's :3 NA's :3
## 2048 2049 2050 2051
## Min. :60.80 Min. :61.00 Min. :61.20 Min. :61.40
## 1st Qu.:73.70 1st Qu.:73.80 1st Qu.:73.97 1st Qu.:74.08
## Median :78.60 Median :78.75 Median :78.90 Median :79.05
## Mean :78.15 Mean :78.29 Mean :78.44 Mean :78.58
## 3rd Qu.:82.92 3rd Qu.:83.10 3rd Qu.:83.22 3rd Qu.:83.40
## Max. :88.70 Max. :88.80 Max. :88.90 Max. :89.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 2052 2053 2054 2055
## Min. :61.60 Min. :61.80 Min. :62.00 Min. :62.20
## 1st Qu.:74.28 1st Qu.:74.38 1st Qu.:74.50 1st Qu.:74.67
## Median :79.25 Median :79.35 Median :79.55 Median :79.70
## Mean :78.72 Mean :78.87 Mean :79.00 Mean :79.14
## 3rd Qu.:83.50 3rd Qu.:83.70 3rd Qu.:83.80 3rd Qu.:83.92
## Max. :89.20 Max. :89.30 Max. :89.40 Max. :89.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 2056 2057 2058 2059
## Min. :62.30 Min. :62.50 Min. :62.70 Min. :62.90
## 1st Qu.:74.80 1st Qu.:74.90 1st Qu.:75.08 1st Qu.:75.20
## Median :79.85 Median :80.00 Median :80.10 Median :80.25
## Mean :79.28 Mean :79.42 Mean :79.56 Mean :79.69
## 3rd Qu.:84.03 3rd Qu.:84.20 3rd Qu.:84.33 3rd Qu.:84.42
## Max. :89.60 Max. :89.80 Max. :89.90 Max. :90.00
## NA's :3 NA's :3 NA's :3 NA's :3
## 2060 2061 2062 2063
## Min. :63.00 Min. :63.20 Min. :63.40 Min. :63.50
## 1st Qu.:75.30 1st Qu.:75.50 1st Qu.:75.60 1st Qu.:75.78
## Median :80.40 Median :80.55 Median :80.70 Median :80.85
## Mean :79.83 Mean :79.96 Mean :80.10 Mean :80.24
## 3rd Qu.:84.60 3rd Qu.:84.72 3rd Qu.:84.83 3rd Qu.:85.00
## Max. :90.10 Max. :90.20 Max. :90.30 Max. :90.50
## NA's :3 NA's :3 NA's :3 NA's :3
## 2064 2065 2066 2067
## Min. :63.70 Min. :63.80 Min. :64.00 Min. :64.10
## 1st Qu.:75.90 1st Qu.:76.00 1st Qu.:76.17 1st Qu.:76.30
## Median :81.00 Median :81.15 Median :81.25 Median :81.40
## Mean :80.36 Mean :80.50 Mean :80.62 Mean :80.76
## 3rd Qu.:85.10 3rd Qu.:85.20 3rd Qu.:85.30 3rd Qu.:85.50
## Max. :90.60 Max. :90.70 Max. :90.80 Max. :90.90
## NA's :3 NA's :3 NA's :3 NA's :3
## 2068 2069 2070 2071
## Min. :64.30 Min. :64.40 Min. :64.50 Min. :64.70
## 1st Qu.:76.40 1st Qu.:76.58 1st Qu.:76.70 1st Qu.:76.80
## Median :81.55 Median :81.65 Median :81.80 Median :81.95
## Mean :80.89 Mean :81.01 Mean :81.15 Mean :81.27
## 3rd Qu.:85.60 3rd Qu.:85.70 3rd Qu.:85.80 3rd Qu.:85.92
## Max. :91.00 Max. :91.20 Max. :91.30 Max. :91.40
## NA's :3 NA's :3 NA's :3 NA's :3
## 2072 2073 2074 2075
## Min. :64.80 Min. :64.90 Min. :65.10 Min. :65.20
## 1st Qu.:77.00 1st Qu.:77.10 1st Qu.:77.28 1st Qu.:77.38
## Median :82.05 Median :82.20 Median :82.30 Median :82.50
## Mean :81.40 Mean :81.53 Mean :81.66 Mean :81.78
## 3rd Qu.:86.03 3rd Qu.:86.12 3rd Qu.:86.30 3rd Qu.:86.40
## Max. :91.50 Max. :91.60 Max. :91.70 Max. :91.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 2076 2077 2078 2079
## Min. :65.30 Min. :65.50 Min. :65.60 Min. :65.70
## 1st Qu.:77.58 1st Qu.:77.67 1st Qu.:77.78 1st Qu.:77.97
## Median :82.60 Median :82.70 Median :82.80 Median :82.95
## Mean :81.91 Mean :82.04 Mean :82.17 Mean :82.28
## 3rd Qu.:86.50 3rd Qu.:86.62 3rd Qu.:86.72 3rd Qu.:86.83
## Max. :92.00 Max. :92.10 Max. :92.20 Max. :92.30
## NA's :3 NA's :3 NA's :3 NA's :3
## 2080 2081 2082 2083
## Min. :65.80 Min. :66.00 Min. :66.10 Min. :66.20
## 1st Qu.:78.08 1st Qu.:78.25 1st Qu.:78.38 1st Qu.:78.47
## Median :83.05 Median :83.15 Median :83.25 Median :83.35
## Mean :82.41 Mean :82.53 Mean :82.66 Mean :82.78
## 3rd Qu.:86.92 3rd Qu.:87.03 3rd Qu.:87.12 3rd Qu.:87.22
## Max. :92.40 Max. :92.50 Max. :92.70 Max. :92.80
## NA's :3 NA's :3 NA's :3 NA's :3
## 2084 2085 2086 2087
## Min. :66.30 Min. :66.50 Min. :66.60 Min. :66.70
## 1st Qu.:78.65 1st Qu.:78.78 1st Qu.:78.88 1st Qu.:79.00
## Median :83.45 Median :83.55 Median :83.70 Median :83.80
## Mean :82.91 Mean :83.03 Mean :83.15 Mean :83.27
## 3rd Qu.:87.33 3rd Qu.:87.50 3rd Qu.:87.53 3rd Qu.:87.70
## Max. :92.90 Max. :93.00 Max. :93.10 Max. :93.30
## NA's :3 NA's :3 NA's :3 NA's :3
## 2088 2089 2090 2091
## Min. :66.80 Min. :66.90 Min. :67.00 Min. :67.10
## 1st Qu.:79.17 1st Qu.:79.28 1st Qu.:79.40 1st Qu.:79.50
## Median :83.90 Median :84.00 Median :84.10 Median :84.20
## Mean :83.39 Mean :83.52 Mean :83.63 Mean :83.76
## 3rd Qu.:87.80 3rd Qu.:87.90 3rd Qu.:88.00 3rd Qu.:88.12
## Max. :93.40 Max. :93.50 Max. :93.60 Max. :93.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 2092 2093 2094 2095
## Min. :67.30 Min. :67.40 Min. :67.50 Min. :67.60
## 1st Qu.:79.70 1st Qu.:79.80 1st Qu.:79.90 1st Qu.:80.08
## Median :84.35 Median :84.45 Median :84.55 Median :84.65
## Mean :83.88 Mean :84.00 Mean :84.12 Mean :84.24
## 3rd Qu.:88.22 3rd Qu.:88.33 3rd Qu.:88.50 3rd Qu.:88.60
## Max. :93.90 Max. :94.00 Max. :94.10 Max. :94.20
## NA's :3 NA's :3 NA's :3 NA's :3
## 2096 2097 2098 2099
## Min. :67.70 Min. :67.80 Min. :67.90 Min. :68.00
## 1st Qu.:80.20 1st Qu.:80.38 1st Qu.:80.47 1st Qu.:80.58
## Median :84.75 Median :84.85 Median :85.00 Median :85.15
## Mean :84.36 Mean :84.48 Mean :84.59 Mean :84.71
## 3rd Qu.:88.70 3rd Qu.:88.80 3rd Qu.:88.90 3rd Qu.:89.00
## Max. :94.30 Max. :94.40 Max. :94.50 Max. :94.70
## NA's :3 NA's :3 NA's :3 NA's :3
## 2100
## Min. :68.10
## 1st Qu.:80.78
## Median :85.25
## Mean :84.83
## 3rd Qu.:89.10
## Max. :94.80
## NA's :3
Plotting data
plots scatter plot of 2nd column or 1800s column for all countries
Life expectancy of all countries increased after 150 rs after great divergence, and industrialisation
To see life expectancy of one country over years or to compare two countries, as the column names are in list so to plot them as vector you need to unlist them by unlist and then make them vector by using as.vector
also as we want to separate a row so we can’t just use $ sign to extract that thing so for rows you need to do this
plot(as.vector(unlist(LifeExpectancyInYears[162, 2:302])), as.vector(unlist(colnames(LifeExpectancyInYears)[2:302])), xlab = "Life expectancy in Years", ylab = "years" )lifeexpectancy of all countries relative to 1800 and 1801 it means values are same, not much has changed in 1 year
In 100 years many countries life expectancy has changed drastically,
Subset the life expectancy of a particular country
LifeExpectancyInYears[LifeExpectancyInYears$country==“Country name”,]
so now we’ll compare lifeexpectancy between Sweden and India, for this at first we’ll unlist it convert it into numeric value by as.numeric and also omit (NA- not available) values by na.omit
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="India",]))))-> indialife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="Sweden",]))))-> swedenlife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="Bangladesh",]))))-> banglalife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="Switzeland",]))))-> Switzerlandlife
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="Spain",]))))-> Spainlife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="Norway",]))))-> Norwaylife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="Finland",]))))-> Finlandlife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
as.vector(na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country=="United States",]))))-> USlife## Warning in
## na.omit(as.numeric(unlist(LifeExpectancyInYears[LifeExpectancyInYears$country
## == : NAs introduced by coercion
Par function is usefull in compairing two values as here Sweden and India, to plot histograms side by side, help you set your display how you want to show multiple graphs,mfrow tells how many subplots you want to plot (1, 2) means we wanted to plot 1 row and 2 columns
let’s add some colours to the Life
Let’s add some colors to your life, here you can see there are many functions written inside “plot()” functions; to give your chart a heading use “main”, to label x and y asis use “xlab” and “yab”, to limit the axes use “ylim” or “xlim” as per use.
Apart from these things you can also define weather the data points need to be shown as points or line in the graph, so here we have used “points” to show individual data points, you can define the size and color of points by “col” function.
NOTE: The color of data points for swedenlife has been specified in the first “plot” command itself, so to add points for other countries you can simply use “points” function and add as may different dataet’s points as you want.
At the end we have specified how the Legend will look like.
plot(c(1800:2100), swedenlife, col="red", main = "Life Expectancy in Years", pch=15, ylim = c(0,100), xlab = "Years", ylab = "Life Expectancy") #pch is just a pint type
points(c(1800:2100),indialife, col="blue")
points(c(1800:2100),banglalife,pch=20, col="green")
legend(x= "topleft", #position
legend = c("sweden", "India", "Bangladesh"), #Texts
fill = c("red", "blue", "green")) #coloursBecome master of Data manipulation using TIDYVERSE
The tidyverse is a collection of R packages designed to work together seamlessly for data science and analysis. The core packages included in the tidyverse are:
ggplot2:
Package for creating static and dynamic graphics using the Grammar of Graphics framework.
dplyr:
Package for data manipulation and transformation, providing a set of verbs for tasks like filtering, arranging, selecting, and summarizing data.
tidyr:
Package for data tidying, with functions to reshape and tidy data into the “tidy” format.
readr:
Package for reading rectangular data (e.g., CSV, TSV) into R as tidy data frames.
purrr:
Package for functional programming and working with lists and vectors. It provides functions like map, reduce, and walk for iteration and manipulation of data structures.
tibble:
Package for creating and working with tibbles, which are a modern and enhanced version of data frames.
stringr:
Package for working with strings, providing functions for text manipulation and pattern matching.
forcats:
Package for working with categorical variables, providing functions for manipulating factor levels.
hms:
Package for working with hours, minutes, and seconds, providing a class for time-of-day data.
lubridate:
Package for working with dates and times, providing functions to parse, manipulate, and format date-time objects.
When you load the tidyverse using library(tidyverse), it automatically loads these core packages along with their dependencies. Keep in mind that the tidyverse ecosystem may evolve, and new packages or updates may be introduced over time. Always check the documentation or the official tidyverse website for the most up-to-date information.
Let’s install tidyverse
## Installing package into 'C:/Users/asus/AppData/Local/R/win-library/4.2'
## (as 'lib' is unspecified)
## package 'tidyverse' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\asus\AppData\Local\Temp\RtmpUPQhTC\downloaded_packages
## Let’s make graphs more beautiful Till now you are able to
plot basic graphs, bar plot etc, but you aren’t satisfied with just
basic things, are you? So let’s make things even more beautiful as you
are ;)
The Basic R comes with tools that can plot only simple graphics, to beautify things further you need to install a packages called “ggplot2” and plotly. As we have already installed “Tidyverse” above we don’t need to install “ggplot” additionaly, still if you want to install it separatly you can do so. Also to use predesigned themes we can install “ggthemes”
To install any pakagage you can use the package fucntion on the right bottom box of your R studio, or you can use the command “install.packages()”
## Installing package into 'C:/Users/asus/AppData/Local/R/win-library/4.2'
## (as 'lib' is unspecified)
## package 'ggplot2' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\asus\AppData\Local\Temp\RtmpUPQhTC\downloaded_packages
## Installing package into 'C:/Users/asus/AppData/Local/R/win-library/4.2'
## (as 'lib' is unspecified)
## package 'plotly' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\asus\AppData\Local\Temp\RtmpUPQhTC\downloaded_packages
## Installing package into 'C:/Users/asus/AppData/Local/R/win-library/4.2'
## (as 'lib' is unspecified)
## package 'ggthemes' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\asus\AppData\Local\Temp\RtmpUPQhTC\downloaded_packages
Difference between ggplot and plotly
You must be wondering what’s the difference between ggplot and plotly.
ggplot2 and plotly are both powerful visualization libraries in R, but they have different approaches and strengths.
ggplot2 is primarily designed for creating static, publication-quality plots. It offers a wide range of geoms (geometric objects) and themes for customization.
plotly is an interactive plotting library that allows you to create web-based, interactive visualizations. It supports a wide variety of chart types, and the resulting plots are interactive, allowing users to zoom, pan, hover over data points, and more.
While ggplot2 is geared towards static plots, plotly shines in creating dynamic and interactive plots. It is particularly useful for creating dashboards, web applications, or any situation where user interaction with the plot is desired.
in a nutshell, Choosing between ggplot2 and plotly depends on your specific needs:
Use ggplot2 when you need high-quality static plots for publications or reports and appreciate the layered and declarative syntax.
Use plotly when you want to create interactive plots for web-based applications, dashboards, or when exploring and sharing data with interactive features.
SO now let’s use the gpplot2 to plot some graphs, for example we’ll first