Setup Stage


Loading packages.

library(dplyr)
library(tidyr)
library(ggplot2)
library(RColorBrewer)
library(plotly)
library(kableExtra)
library(viridis)
library(hrbrthemes)
library(ggExtra)
library(scales)
library(gganimate)
library(ggridges)
library(RJSONIO)

Loading data..

Lasair <- read.csv("Dataset/Particle Counter.csv")

Processing data..

Lasair <- Lasair %>%
  group_by(Session,Date,Time) %>%
  mutate(Avg = mean(c(X0.3u,X0.5u,X1u,X5u,X10u,X25u)),
         Std = sd(c(X0.3u,X0.5u,X1u,X5u,X10u,X25u)))

LasairScaled <- Lasair %>%
  group_by(Session,Date,Time) %>%
  mutate(X0.3u = X0.3u/mean(Lasair$X0.3u),
         X0.5u = X0.5u/mean(Lasair$X0.5u),
         X1u = X1u/mean(Lasair$X1u),
         X5u = X5u/mean(Lasair$X5u),
         X10u = X10u/mean(Lasair$X10u),
         X25u = X25u/mean(Lasair$X25u))
  
LasairPivotted1 <- Lasair %>%
    pivot_longer(cols = -c("Date","Time", "Elapsed", "Minutes", "Session", "Scene", "Detail","Volume","X5u","X10u","X25u","Avg", "Std"), names_to="Particles_S",values_to="Count_S") %>%
    pivot_longer(cols = -c("Date","Time", "Elapsed", "Minutes", "Session", "Scene", "Detail","Volume","Particles_S","Count_S","Avg", "Std"), names_to="Particles_L",values_to="Count_L")

LasairPivotted2 <- Lasair %>%
    pivot_longer(cols = -c("Date","Time", "Elapsed", "Minutes", "Session", "Scene", "Detail","Volume","Avg", "Std"), names_to="Particles",values_to="Count")

LasairPivotted2$Particles <- factor(LasairPivotted2$Particles,levels = c("X0.3u", "X0.5u", "X1u", "X5u", "X10u", "X25u"))

LasairScaledPivotted <- LasairScaled %>%
  pivot_longer(cols = -c("Date","Time", "Elapsed", "Minutes", "Session", "Scene", "Detail","Volume","Avg", "Std"), names_to="Particles",values_to="Count")

LasairScaledPivotted$Particles <- factor(LasairScaledPivotted$Particles,levels = c("X0.3u", "X0.5u", "X1u", "X5u", "X10u", "X25u"))


Displaying raw tidy data table

Lasair %>%
    kable(escape = FALSE, align='c', caption = "Lasair Data August-Sept 2020") %>%
    kable_styling("striped", full_width = T) %>%
    column_spec(1, bold = T, color = "white", background = "#777777") %>%
    column_spec(c(2:4), color = "white", background = "#BF1165") %>%
    column_spec(c(5:6), bold = T, background = "#11BF6B") %>%
    scroll_box(width = "100%", height = "600px")
Lasair Data August-Sept 2020
Date Time Elapsed Minutes Session Scene Volume X0.3u X0.5u X1u X5u X10u X25u Detail Avg Std
26/8/2020 07:30 00:00 0 Office Wed Office-Quiet 0.0283290 15941 11713 13377 2010 462 32 N/A 7255.8333 7192.0212
26/8/2020 08:00 00:30 30 Office Wed Office-Quiet 0.0283213 16101 10564 9403 1283 387 34 N/A 6578.3333 6666.7627
26/8/2020 08:00 00:30 30 Office Wed Office-Quiet 0.0283232 17382 11781 10210 1335 436 24 N/A 6578.3333 6666.7627
26/8/2020 08:30 01:00 60 Office Wed Office-Busy 0.0283212 38239 22235 8693 259 57 1 N/A 11580.6667 15668.9750
27/8/2020 12:30 00:00 0 Office Thu Office-Busy 0.0283151 57729 29920 25282 3185 474 24 N/A 19435.6667 22851.3545
27/8/2020 13:00 00:30 30 Office Thu Office-Busy 0.0283156 46436 22658 11148 391 43 3 N/A 13446.5000 18489.2917
27/8/2020 13:30 01:00 60 Office Thu Office-Busy 0.0283232 38681 19055 7878 147 9 0 N/A 10961.6667 15494.8284
27/8/2020 14:00 01:30 90 Office Thu Office-Busy 0.0283164 34920 17123 6989 116 40 0 N/A 9864.6667 13982.8096
27/8/2020 14:30 02:00 120 Office Thu Office-Busy 0.0283167 29846 15757 8202 485 79 4 N/A 9062.1667 11948.5887
27/8/2020 15:00 02:30 150 Office Thu Office-Busy 0.0283166 29281 15520 9144 685 110 7 N/A 9124.5000 11685.9101
27/8/2020 15:30 03:00 180 Office Thu Office-Busy 0.0283172 29601 13580 5684 156 14 0 N/A 8172.5000 11766.3032
27/8/2020 16:00 03:30 210 Office Thu Office-Busy 0.0283165 135868 20902 5294 355 64 5 N/A 27081.3333 53897.6287
27/8/2020 16:30 04:00 240 Office Thu Office-Busy 0.0283181 4352 1435 492 7 0 0 N/A 1047.6667 1712.0519
27/8/2020 17:00 04:30 270 Office Thu Office-Quiet 0.0283166 4402 1406 462 1 0 0 N/A 1045.1667 1732.8384
27/8/2020 17:30 05:00 300 Office Thu Office-Quiet 0.0283161 4460 1387 424 3 0 0 N/A 1045.6667 1756.9656
27/8/2020 18:00 05:30 330 Office Thu Office-Quiet 0.0283168 4331 1286 364 0 0 0 N/A 996.8333 1707.7349
27/8/2020 18:30 06:00 360 Office Thu Office-Quiet 0.0283154 4130 1166 312 1 0 0 N/A 934.8333 1629.1299
27/8/2020 19:00 06:30 390 Office Thu Office-Quiet 0.0283262 4618 1238 329 0 0 0 N/A 1030.8333 1821.5985
27/8/2020 19:30 07:00 420 Office Thu Office-Quiet 0.0283093 4876 1228 281 3 2 0 N/A 1065.0000 1926.4986
27/8/2020 20:00 07:30 450 Office Thu Office-Quiet 0.0283165 4037 1004 242 0 0 0 N/A 880.5000 1594.5073
27/8/2020 20:30 08:00 480 Office Thu Office-Quiet 0.0283168 5410 1230 266 0 0 0 N/A 1151.0000 2140.2313
27/8/2020 21:00 08:30 510 Office Thu Office-Quiet 0.0283253 6370 1463 333 1 0 0 N/A 1361.1667 2518.3928
27/8/2020 21:30 09:00 540 Office Thu Office-Quiet 0.0283157 5579 1247 264 2 0 0 N/A 1182.0000 2207.5872
27/8/2020 22:00 09:30 570 Office Thu Office-Quiet 0.0283248 5616 1159 236 3 0 0 N/A 1169.0000 2224.3685
28/8/2020 09:00 00:00 0 Office Fri Office-Busy 0.0283223 9524 2854 1841 239 45 2 N/A 2417.5000 3667.0011
28/8/2020 09:30 00:30 30 Office Fri Office-Busy 0.0283206 14351 4753 3949 706 202 29 N/A 3998.3333 5454.4821
28/8/2020 10:00 01:00 60 Office Fri Office-Busy 0.0283163 10583 2816 824 26 1 0 N/A 2375.0000 4165.7088
28/8/2020 10:30 01:30 90 Office Fri Office-Busy 0.0283092 12495 3740 991 9 2 0 N/A 2872.8333 4931.0397
28/8/2020 11:00 02:00 120 Office Fri Office-Busy 0.0283168 128245 45767 17966 347 68 8 N/A 32066.8333 50387.7163
28/8/2020 11:30 02:30 150 Office Fri Office-Busy 0.0283155 130208 46926 16750 153 6 0 N/A 32340.5000 51305.5768
28/8/2020 12:00 03:00 180 Office Fri Office-Busy 0.0283166 143222 45047 16740 285 44 3 N/A 34223.5000 56204.2642
28/8/2020 12:30 03:30 210 Office Fri Office-Busy 0.0283169 117502 49874 29420 1544 152 9 N/A 33083.5000 46032.5354
28/8/2020 23:00 00:00 0 Bedroom 1 Home-Quiet 0.0283495 402372 109879 23962 564 109 12 N/A 89483.0000 159064.6943
28/8/2020 23:30 00:30 30 Bedroom 1 Home-Quiet 0.0283155 10578 1717 498 3 0 0 N/A 2132.6667 4190.4793
29/8/2020 00:00 01:00 60 Bedroom 1 Home-Quiet 0.0283157 5192 951 246 1 0 0 N/A 1065.0000 2055.0636
29/8/2020 00:30 01:30 90 Bedroom 1 Home-Quiet 0.0283176 54345 57448 13654 3 0 0 N/A 20908.3333 27630.1757
29/8/2020 01:00 02:00 120 Bedroom 1 Home-Quiet 0.0283161 49467 49576 12713 2 0 0 N/A 18626.3333 24432.5295
29/8/2020 02:00 03:00 180 Bedroom 1 Home-Quiet 0.0283085 8254 4794 1315 0 0 0 N/A 2393.8333 3419.2850
29/8/2020 02:30 03:30 210 Bedroom 1 Home-Quiet 0.0283144 4088 732 297 1 0 0 N/A 853.0000 1610.5977
29/8/2020 03:00 04:00 240 Bedroom 1 Home-Quiet 0.0283145 2153 538 168 0 0 0 N/A 476.5000 847.4389
29/8/2020 03:30 04:30 270 Bedroom 1 Home-Quiet 0.0283244 1681 435 167 1 0 0 N/A 380.6667 659.3077
29/8/2020 04:00 05:00 300 Bedroom 1 Home-Quiet 0.0283171 1594 514 191 1 0 0 N/A 383.3333 626.0746
29/8/2020 04:30 05:30 330 Bedroom 1 Home-Quiet 0.0283077 1553 530 205 0 0 0 N/A 381.3333 610.2857
29/8/2020 05:00 06:00 360 Bedroom 1 Home-Quiet 0.0283146 1132 423 160 0 0 0 N/A 285.8333 446.2620
29/8/2020 05:30 06:30 390 Bedroom 1 Home-Quiet 0.0283174 1706 694 193 0 0 0 N/A 432.1667 679.5164
29/8/2020 06:00 07:00 420 Bedroom 1 Home-Quiet 0.0283171 976 334 133 0 0 0 N/A 240.5000 383.3483
29/8/2020 06:30 07:30 450 Bedroom 1 Home-Quiet 0.0283169 891 353 116 0 0 0 N/A 226.6667 353.1797
29/8/2020 07:00 08:00 480 Bedroom 1 Home-Quiet 0.0283253 927 300 105 0 0 0 N/A 222.0000 364.5957
29/8/2020 07:30 08:30 510 Bedroom 1 Home-Quiet 0.0283184 6988 2232 766 5 0 0 N/A 1665.1667 2748.2383
29/8/2020 08:00 09:00 540 Bedroom 1 Home-Quiet 0.0283160 20291 7359 4037 324 82 6 N/A 5349.8333 7881.1721
30/8/2020 22:00 00:00 0 Bedroom 2 Home-Quiet 0.0080249 140554 286605 201534 148 39 4 N/A 104814.0000 123772.3571
30/8/2020 22:30 00:30 30 Bedroom 2 Home-Quiet 0.0283190 211330 477011 1382295 1130 269 48 N/A 345347.1667 541729.2107
30/8/2020 23:00 01:00 60 Bedroom 2 Home-Quiet 0.0283157 19146 10537 6156 10 0 0 N/A 5974.8333 7762.7614
30/8/2020 23:30 01:30 90 Bedroom 2 Home-Quiet 0.0283156 11647 8980 5725 8 0 0 N/A 4393.3333 5162.5659
31/8/2020 00:00 02:00 120 Bedroom 2 Home-Quiet 0.0283167 7253 5204 3123 3 0 0 N/A 2597.1667 3129.5084
31/8/2020 00:30 02:30 150 Bedroom 2 Home-Quiet 0.0283241 3503 2629 1471 4 0 0 N/A 1267.8333 1529.8431
31/8/2020 01:00 03:00 180 Bedroom 2 Home-Quiet 0.0283162 5360 3558 2036 4 0 0 N/A 1826.3333 2259.2616
31/8/2020 01:30 03:30 210 Bedroom 2 Home-Quiet 0.0283174 6530 5341 3231 5 0 0 N/A 2517.8333 2951.9370
31/8/2020 02:00 04:00 240 Bedroom 2 Home-Quiet 0.0283152 11842 8930 5249 7 0 0 N/A 4338.0000 5188.8428
31/8/2020 02:30 04:30 270 Bedroom 2 Home-Quiet 0.0283167 11284 8848 5323 7 0 0 N/A 4243.6667 5017.9258
31/8/2020 03:00 05:00 300 Bedroom 2 Home-Quiet 0.0283158 9750 8427 5197 7 0 0 N/A 3896.8333 4516.0564
31/8/2020 03:30 05:30 330 Bedroom 2 Home-Quiet 0.0283200 5662 4519 2733 5 0 0 N/A 2153.1667 2535.0408
31/8/2020 04:30 06:30 360 Bedroom 2 Home-Quiet 0.0283171 3834 3087 1764 0 0 0 N/A 1447.5000 1718.6788
31/8/2020 05:00 07:00 390 Bedroom 2 Home-Quiet 0.0283177 2663 2043 1077 1 0 0 N/A 964.0000 1170.4334
31/8/2020 05:30 07:30 420 Bedroom 2 Home-Quiet 0.0283155 5533 4759 2865 4 0 0 N/A 2193.5000 2553.4979
31/8/2020 06:00 08:00 450 Bedroom 2 Home-Quiet 0.0283164 2540 2070 1133 1 0 0 N/A 957.3333 1142.0392
31/8/2020 22:30 00:00 0 Bedroom 3 Home-Quiet 0.0283411 866401 809642 475378 712 261 24 N/A 358736.3333 414730.0660
31/8/2020 23:00 00:30 30 Bedroom 3 Home-Quiet 0.0283164 49251 11586 4817 8 0 0 N/A 10943.6667 19310.7064
31/8/2020 23:30 01:00 60 Bedroom 3 Home-Quiet 0.0283165 16268 6257 3306 4 0 0 N/A 4305.8333 6379.4407
1/9/2020 00:00 01:30 90 Bedroom 3 Home-Quiet 0.0283182 23610 8997 4083 3 0 0 N/A 6115.5000 9280.6569
1/9/2020 00:30 02:00 120 Bedroom 3 Home-Quiet 0.0283157 11067 5461 3197 7 0 0 N/A 3288.6667 4418.8210
1/9/2020 01:00 02:30 150 Bedroom 3 Home-Quiet 0.0283163 11917 5712 3280 4 0 0 N/A 3485.5000 4743.5849
1/9/2020 01:30 03:00 180 Bedroom 3 Home-Quiet 0.0283169 11952 6304 3575 7 0 0 N/A 3639.6667 4814.3193
1/9/2020 02:00 03:30 210 Bedroom 3 Home-Quiet 0.0283152 5109 2888 1667 2 0 0 N/A 1611.0000 2080.8360
1/9/2020 02:30 04:00 240 Bedroom 3 Home-Quiet 0.0283166 2344 1240 779 1 0 0 N/A 727.3333 944.9545
1/9/2020 03:00 04:30 270 Bedroom 3 Home-Quiet 0.0283200 4033 2479 1435 1 0 0 N/A 1324.6667 1669.8087
1/9/2020 03:30 05:00 300 Bedroom 3 Home-Quiet 0.0283174 1572 942 600 1 0 0 N/A 519.1667 648.2815
1/9/2020 04:30 06:00 330 Bedroom 3 Home-Quiet 0.0283170 1924 1074 637 2 0 0 N/A 606.1667 781.8436
1/9/2020 05:00 06:30 360 Bedroom 3 Home-Quiet 0.0283179 2239 1418 824 0 0 0 N/A 746.8333 933.4089
1/9/2020 05:30 07:00 390 Bedroom 3 Home-Quiet 0.0283183 1750 1082 670 1 0 0 N/A 583.8333 726.2172
1/9/2020 06:00 07:30 420 Bedroom 3 Home-Quiet 0.0283180 1307 884 454 0 0 0 N/A 440.8333 553.1396
1/9/2020 19:00 00:00 0 Damie’s House 1 Home-Busy 0.0283440 532792 164975 45740 243 167 23 Kitchen Cooking 123990.0000 210207.1266
1/9/2020 19:30 00:30 30 Damie’s House 1 Home-Busy 0.0283158 256294 76537 19789 63 24 2 Kitchen Cooking 58784.8333 101195.0553
1/9/2020 20:00 01:00 60 Damie’s House 1 Home-Busy 0.0283169 174193 52718 13385 39 24 3 TV Lounge (Open Door, a few people in the room) 40060.3333 68807.8008
1/9/2020 20:30 01:30 90 Damie’s House 1 Home-Busy 0.0283114 192864 59862 16691 716 1087 136 TV Lounge (Open Door, a few people in the room) 45226.0000 75878.7682
1/9/2020 21:00 02:00 120 Damie’s House 1 Home-Busy 0.0283165 179088 55462 14262 272 127 12 TV Lounge (Open Door, a few people in the room) 41537.1667 70710.7104
1/9/2020 21:30 02:30 150 Damie’s House 1 Home-Busy 0.0283149 132035 39427 9306 75 62 6 TV Lounge (Open Door, a few people in the room) 30151.8333 52191.0766
1/9/2020 22:00 03:00 180 Damie’s House 1 Home-Busy 0.0283158 121181 35687 8190 58 107 15 TV Lounge (Open Door, a few people in the room) 27539.6667 47905.9254
1/9/2020 22:30 03:30 210 Damie’s House 1 Home-Busy 0.0283156 120615 34698 8673 42 39 3 TV Lounge (Open Door, a few people in the room) 27345.0000 47624.9084
1/9/2020 23:00 00:00 0 Damie’s Office Night Office-Quiet 0.0283005 84686 24411 5500 223 182 21 Night time - Office (door closed, ventilation system off) 19170.5000 33445.1802
1/9/2020 23:30 00:30 30 Damie’s Office Night Office-Quiet 0.0283173 6584 1811 417 1 1 0 Night time - Office (door closed, ventilation system off) 1469.0000 2602.1108
1/9/2020 00:00 01:00 60 Damie’s Office Night Office-Quiet 0.0283164 3400 997 250 0 0 0 Night time - Office (door closed, ventilation system off) 774.5000 1342.9376
2/9/2020 00:30 01:30 90 Damie’s Office Night Office-Quiet 0.0283165 3664 1122 295 1 0 0 Night time - Office (door closed, ventilation system off) 847.0000 1446.8139
2/9/2020 01:00 02:00 120 Damie’s Office Night Office-Quiet 0.0283168 3873 1278 335 0 0 0 Night time - Office (door closed, ventilation system off) 914.3333 1531.6400
2/9/2020 01:30 02:30 150 Damie’s Office Night Office-Quiet 0.0283163 3616 1196 317 0 0 0 Night time - Office (door closed, ventilation system off) 854.8333 1429.8196
2/9/2020 02:00 03:00 180 Damie’s Office Night Office-Quiet 0.0283168 3722 1246 360 1 0 0 Night time - Office (door closed, ventilation system off) 888.1667 1469.8545
2/9/2020 02:30 03:30 210 Damie’s Office Night Office-Quiet 0.0283153 3757 1290 332 0 0 0 Night time - Office (door closed, ventilation system off) 896.5000 1487.7567
2/9/2020 03:00 04:00 240 Damie’s Office Night Office-Quiet 0.0283177 3886 1456 384 2 0 0 Night time - Office (door closed, ventilation system off) 954.6667 1542.7288
2/9/2020 03:30 04:30 270 Damie’s Office Night Office-Quiet 0.0283157 3882 1441 428 0 0 0 Night time - Office (door closed, ventilation system off) 958.5000 1537.3520
2/9/2020 04:00 05:00 300 Damie’s Office Night Office-Quiet 0.0283156 3831 1482 354 1 0 0 Night time - Office (door closed, ventilation system off) 944.6667 1526.0296
2/9/2020 04:30 05:30 330 Damie’s Office Night Office-Quiet 0.0283177 3871 1589 420 0 0 0 Night time - Office (door closed, ventilation system off) 980.0000 1544.2514
2/9/2020 05:00 06:00 360 Damie’s Office Night Office-Quiet 0.0283160 3775 1592 390 0 0 0 Night time - Office (door closed, ventilation system off) 959.5000 1510.8506
2/9/2020 05:30 06:30 390 Damie’s Office Night Office-Quiet 0.0283160 3763 1620 394 1 0 0 Night time - Office (door closed, ventilation system off) 963.0000 1508.3496
2/9/2020 06:00 07:00 420 Damie’s Office Night Office-Quiet 0.0283154 3094 1435 364 2 1 0 Night time - Office (door closed, ventilation system off) 816.0000 1246.5493
2/9/2020 06:30 07:30 450 Damie’s Office Night Office-Quiet 0.0283164 3218 1452 391 0 1 0 Night time - Office (door closed, ventilation system off) 843.6667 1291.9806
2/9/2020 07:00 08:00 480 Damie’s Office Night Office-Quiet 0.0283168 3113 1353 328 1 0 0 Night time - Office (door closed, ventilation system off) 799.1667 1248.7561
2/9/2020 07:30 00:00 0 Damie’s Office Morning Office-Busy 0.0283169 19177 8523 1593 8 2 0 Office (door closed, ventilation system on) 4883.8333 7743.7150
2/9/2020 08:00 00:30 30 Damie’s Office Morning Office-Busy 0.0283166 22947 10662 2150 7 0 0 Office (door closed, ventilation system on) 5961.0000 9291.5497
2/9/2020 08:30 01:00 60 Damie’s Office Morning Office-Busy 0.0283164 19737 11838 4243 107 133 13 Office (door closed, ventilation system on) 6011.8333 8134.7026
2/9/2020 09:00 01:30 90 Damie’s Office Morning Office-Busy 0.0283240 68295 38214 14427 316 337 53 Office (door closed, ventilation system on - teams call) 20273.6667 27809.1425
2/9/2020 09:30 02:00 120 Damie’s Office Morning Office-Busy 0.0283169 12500 8843 3924 54 59 1 Office (door closed, ventilation system on) 4230.1667 5338.2949
2/9/2020 18:30 00:00 0 Damie’s House 2 Home-Busy 0.0278886 115571 77845 37802 464 206 149 TV Lounge (Open Door, a few people in the room) 38672.8333 48728.3141
2/9/2020 19:00 00:30 30 Damie’s House 2 Home-Busy 0.0283168 259863 113763 47957 583 152 15 TV Lounge (Open Door, a few people in the room) 70388.8333 102998.5523
2/9/2020 19:30 01:00 60 Damie’s House 2 Home-Busy 0.0283246 204659 83146 32314 544 505 44 TV Lounge (Open Door, a few people in the room) 53535.3333 80804.8508
2/9/2020 20:00 01:30 90 Damie’s House 2 Home-Busy 0.0283237 257563 97144 36889 395 244 25 Kitchen - Cooking 65376.6667 101481.0514
2/9/2020 23:00 00:00 120 Damie’s House 2 Home-Busy 0.0283347 111785 34861 9174 489 914 135 TV Lounge (Open Door) 26226.3333 43976.1463
2/9/2020 23:30 00:30 0 Damie’s House Night Home-Quiet 0.0283153 69745 22611 5981 94 107 5 Night time - TV Lounge (Open Door, ventilation system off) 16423.8333 27542.5533
3/9/2020 00:00 01:00 30 Damie’s House Night Home-Quiet 0.0283167 45828 14845 3952 37 8 0 Night time - TV Lounge (Open Door, ventilation system off) 10778.3333 18106.1566
3/9/2020 00:30 01:30 60 Damie’s House Night Home-Quiet 0.0283164 40008 12991 3396 17 3 0 Night time - TV Lounge (Open Door, ventilation system off) 9402.5000 15814.5327
3/9/2020 01:00 02:00 90 Damie’s House Night Home-Quiet 0.0283169 32244 10241 2636 9 1 0 Night time - TV Lounge (Open Door, ventilation system off) 7521.8333 12743.8953
3/9/2020 01:30 02:30 120 Damie’s House Night Home-Quiet 0.0283162 30008 9336 2323 4 1 0 Night time - TV Lounge (Open Door, ventilation system off) 6945.3333 11862.6420
3/9/2020 02:00 03:00 150 Damie’s House Night Home-Quiet 0.0283177 27080 8320 2081 8 1 0 Night time - TV Lounge (Open Door, ventilation system off) 6248.3333 10701.6766
3/9/2020 02:30 03:30 180 Damie’s House Night Home-Quiet 0.0283166 25818 8189 1987 6 0 0 Night time - TV Lounge (Open Door, ventilation system off) 6000.0000 10213.4916
3/9/2020 03:00 04:00 210 Damie’s House Night Home-Quiet 0.0283171 24937 8085 2063 5 0 0 Night time - TV Lounge (Open Door, ventilation system off) 5848.3333 9861.6345
3/9/2020 03:30 04:30 240 Damie’s House Night Home-Quiet 0.0283169 23383 7886 2061 3 0 0 Night time - TV Lounge (Open Door, ventilation system off) 5555.5000 9252.2423
3/9/2020 04:30 05:30 270 Damie’s House Night Home-Quiet 0.0283176 22364 7507 2002 4 0 0 Night time - TV Lounge (Open Door, ventilation system off) 5312.8333 8844.8220
3/9/2020 05:00 06:00 300 Damie’s House Night Home-Quiet 0.0283176 21123 7123 1900 8 0 0 Night time - TV Lounge (Open Door, ventilation system off) 5025.6667 8354.4523
3/9/2020 05:30 06:30 330 Damie’s House Night Home-Quiet 0.0283168 20456 6907 1810 2 0 0 Night time - TV Lounge (Open Door, ventilation system off) 4862.5000 8094.0379
3/9/2020 06:00 07:00 360 Damie’s House Night Home-Quiet 0.0283161 20169 7256 1830 3 0 0 Night time - TV Lounge (Open Door, ventilation system off) 4876.3333 8001.4404
3/9/2020 06:30 07:30 390 Damie’s House Night Home-Quiet 0.0283145 19167 7076 1981 7 0 0 Night time - TV Lounge (Open Door, ventilation system off) 4705.1667 7596.5323
3/9/2020 07:00 08:00 420 Damie’s House Night Home-Quiet 0.0283149 19199 7248 2215 12 15 5 Night time - TV Lounge (Open Door, ventilation system off) 4782.3333 7600.2296




Timeline


In this section we will look at how the particles behave across the timeline with the City Touch in place.



1. Particles Concentration

This particle concentration take the mean of combined particles for each Session and plot it on the Elapsed timeline. This chart use Log2 scale.

ggplot(Lasair, aes(x = Avg, y = Elapsed, fill = stat(x))) +
  geom_density_ridges_gradient(scale = 3, rel_min_height = 0.01, gradient_lwd = 1.) +
  scale_fill_viridis(option="magma") +
  labs(title = 'Particles Concentration Over Time') +
  theme_ridges(font_size = 13, grid = TRUE) + 
    theme(
      legend.position="none",
      panel.spacing = unit(0.1, "lines"),
      strip.text.x = element_text(size = 8)
    ) +
  scale_x_continuous(trans = "log2") +
  annotation_logticks(sides="lb") +
  ylab("Elapsed Time") +
  xlab("Particles Count (Log2 Scale)")


2. Particles Trend Line

This chart take mean of each Particle from every Session and plot it to the Elapsed time without the log scale.

P2 <- Lasair %>%
  group_by(Elapsed) %>%
  summarise("0.3μ" = mean(X0.3u),
            "0.5μ" = mean(X0.5u),
            "1μ" = mean(X1u),
            "5μ" = mean(X5u),
            "10μ" = mean(X10u),
            "25μ" = mean(X25u))  %>%
  pivot_longer(cols = -c("Elapsed"), names_to="Particles",values_to="Count")

P2$Particles <- factor(P2$Particles,levels = c("0.3μ", "0.5μ","1μ", "5μ", "10μ", "25μ"))

P2 %>%  
  ggplot( aes(x=Elapsed, y=Count, group=Particles, color=Particles)) +
  geom_line(size = 1.2) +
  geom_smooth(method= "auto") +
  scale_color_viridis(discrete = TRUE) +
  theme(legend.position="bottom",
        plot.title = element_text(size=14)) +
  ggtitle("Average Particle Trend Lines") +
  ylab("Count") +
  xlab("Elapsed Time") +
  theme_ipsum() +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  scale_color_manual(name="",
                    values=c("#9b2948", "#ff7251", "#ffca7b", "#93e9be", "#87ceeb", "#0099ff"))


3. Particles Distribution

This chart shows distribution for each Particle and plot it to the Elapsed time without the log scale. The chart divided by two groups: small particles and large particles.

ggplot(LasairPivotted1, aes(x=Elapsed, y=Count_S, group=Particles_S, color=Particles_S)) + 
    geom_point(size=2) +
    theme(legend.position="bottom") +
    theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
    ggtitle("Small Particles Distribution") +
    ylab("Count") +
    xlab("Elapsed Time") +
    labs(fill = "Small Particles") +
    scale_color_manual(name="", limits=c("X0.3u","X0.5u","X1u"), values=c("#9b2948", "#ff7251", "#ffca7b"),
                       labels=c("0.3μ", "0.5μ", "1μ")) +
    scale_y_continuous(labels = comma)

ggplot(LasairPivotted1, aes(x=Elapsed, y=Count_L, group=Particles_L, color=Particles_L)) + 
    geom_point(size=2) +
    theme_dark() +
    theme(legend.position="bottom") +
    theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
    ggtitle("Large Particles Distribution") +
    ylab("Count") +
    xlab("Elapsed Time") +
    labs(fill = "Large Particles") +
    scale_color_manual(name="", limits=c("X5u","X10u","X25u"), values=c("#93e9be", "#87ceeb", "#0099ff"),
                       labels=c("5μ", "10μ", "25μ"))


4. Animated Particles Distribution

Animated violin plot gives us the ranges and distribution for each Particles and take Elapsed time as animated frames.

LasairPivotted2 %>%
  ggplot(aes(Particles, Count, color=Particles)) +
  geom_violin() +
  ggtitle("Particle Distribution") +
  stat_summary(fun.y=mean, geom="point", shape=8, size=6) +
  geom_point() +
  geom_hline(aes(yintercept = mean(Lasair$Avg, na.rm=T), linetype = "Average"),
             col = "red",
             alpha = 0.5) +
  scale_linetype_manual(name = "", values = c(1, 1)) +
  scale_x_discrete(labels=c("X0.3u" = "0.3μ", "X0.5u" = "0.5μ", "X1u" = "1μ", "X5u" = "5μ", "X10u" = "10μ", "X25u" = "25μ")) +
  theme(legend.position="bottom") +
  scale_y_continuous(trans = "log2") +
  annotation_logticks(sides="lb") +
  scale_color_manual(name="", limits=c("X0.3u","X0.5u","X1u","X5u","X10u","X25u"), values=c("#9b2948", "#ff7251", "#ffca7b", "#93e9be", "#87ceeb", "#0099ff"),
                       labels=c("0.3μ", "0.5μ","1μ", "5μ", "10μ", "25μ")) +
  transition_time(Minutes) +
  labs(title = "Elapsed Time: {frame_time} minutes")




Scene

In this section, we will look at how different environmental scene affect the particle behaviour.


5. Particles Trendline in Different Environment

This shows the trend lines of different particles in different environmental setting.

LasairPivotted2 %>%
  ggplot( aes(x=Elapsed, y=Count, group=Particles, color=Particles)) +
    geom_line() +
  theme(legend.position="bottom") +
  scale_y_continuous(trans = "log2") +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  facet_wrap(~Scene)+
  ggtitle("Particles Trendline in Different Environment") +
  ylab("Count (Log2 Scale)") +
  xlab("Elapsed Time") +
  scale_color_manual(name="", limits=c("X0.3u","X0.5u","X1u","X5u","X10u","X25u"), values=c("#9b2948", "#ff7251", "#ffca7b", "#93e9be", "#87ceeb", "#0099ff"),
                       labels=c("0.3μ", "0.5μ","1μ", "5μ", "10μ", "25μ"))


6. Particle Heat Map

For these following plots, the Count of each particle are scaled individually to get the relative value of the observed particles. The mean of each particle is used as a its centre point.

LasairScaledPivotted %>%
  group_by(Scene, Elapsed) %>%
  ggplot(aes(Particles,Elapsed,fill=Count))+
  geom_tile(color= "white",size=0.1) + 
  scale_fill_viridis(name="Particle Count",option ="C") +
  scale_x_discrete(labels=c("X0.3u" = "0.3μ", "X0.5u" = "0.5μ", "X1u" = "1μ", "X5u" = "5μ", "X10u" = "10μ", "X25u" = "25μ")) +
  facet_grid(~Scene) + 
  #scale_y_discrete(trans = "reverse") +
  theme_minimal(base_size = 8) +
  labs(title= paste("Scaled Particle Heat Map"), x="Particle", y="Elapsed Time") +
  scale_fill_gradient2(low="green", mid="lightblue", high="red",
               midpoint=mean(LasairScaledPivotted$Count),
               breaks=seq(0,3,1), #breaks in the scale bar
               limits=c(0, 3),
               label=c("Low","Mid-Lo","Mid-Hi", "High")) +
  theme(legend.position = "bottom") +
  theme(plot.title=element_text(size = 14))+
  theme(axis.text.y=element_text(size=6)) +
  theme(strip.background = element_rect(colour="white"))+
  theme(plot.title=element_text(hjust=0))+
  theme(axis.ticks=element_blank())+
  theme(axis.text=element_text(size=7))+
  theme(legend.title=element_text(size=8))+
  theme(legend.text=element_text(size=6))+
  removeGrid()#ggExtra


7. Animated Bar Graph

Again, scaled Count is used in this plot. And the count is limited to 300% of its mean.

LasairScaledPivottedLimited <- LasairScaledPivotted %>%
  mutate(Count = ifelse(Count>3,3,Count))

LSPL <- ggplot(LasairScaledPivottedLimited, aes(x=Particles, y=Count, fill=Particles)) + 
  geom_bar(stat='identity') +
  theme_bw() +
  scale_x_discrete(labels=c("X0.3u" = "0.3μ", "X0.5u" = "0.5μ", "X1u" = "1μ", "X5u" = "5μ", "X10u" = "10μ", "X25u" = "25μ")) +
  scale_fill_manual(name="",
                     limits=c("X0.3u","X0.5u","X1u","X5u","X10u","X25u"),
                     values=c("#9b2948", "#ff7251", "#ffca7b", "#93e9be", "#87ceeb", "#0099ff"),
                     labels=c("0.3μ", "0.5μ","1μ", "5μ", "10μ", "25μ")) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  facet_grid(~Scene) +
  coord_cartesian(ylim = c(0, 3)) +
  transition_time(Minutes) +
  labs(title = "Elapsed Time: {frame_time} minutes")

animate(LSPL, fps=5)

LSPL





To be continued..

There are still a lot of room for improvement here. With the better data quality we can expand this and generate more insight that can be useful for us and the customers.

For further suggestion we might want to include: - The air quality comparison between with and without air cleaner - Room size (m3) - Number of people in the room (0,2,4,8,16,…) - Distance between the particle counter and the air cleaner. - etc.

New data can be fitted to this preexisted model to generate different result.

This preview page can be updated with the new data.




End of Report