A pipeline for evaluating the RGB and PS2 data

Load the RGB data

list.files()
## [1] "20240614_Annie_VIGS_1x1.xlsx - Sheet1.csv"
## [2] "20240708_Annie_VIGS.html"                 
## [3] "20240708_Annie_VIGS.nb.html"              
## [4] "20240708_Annie_VIGS.Rmd"                  
## [5] "Annie_VIGS_Suvita_20240621.csv"           
## [6] "Annie_VIGS_Suvita_20240621.TXT"           
## [7] "consolidated_data.csv"                    
## [8] "rsconnect"
RGB <- read.csv("consolidated_data.csv")
RGB$measurement_value <- as.numeric(as.character(RGB$measurement_value))
RGB

Let’s separate the file_name into individual sections - including timestamp, trayID and so on.

strsplit(RGB$file_name[1], "_")
## [[1]]
## [1] "20240614-110819" "36838114852864"  "00034913"        "010104"         
## [5] "040284"          "Side01.xml"

1st element is timestamp (YYYMMDD-HHMMSS), then some unknown ID, then tray ID, experiment ID, some other unknown ID and side.xml file

We will need timestamp and trayID for this experiment:

timestamp <- strsplit(RGB$file_name[1], "_")[[1]][1]
tray.ID <- strsplit(RGB$file_name[1], "_")[[1]][3]

Now let’s loop it into all of the rows of our dataset:

for(i in 1:nrow(RGB)){
  RGB$timestamp[i]  <- strsplit(RGB$file_name[i], "_")[[1]][1]
  RGB$tray.ID[i] <- strsplit(RGB$file_name[i], "_")[[1]][3]
}
RGB$tray.ID <- as.numeric(as.character(RGB$tray.ID))
unique(RGB$tray.ID)
## [1] 34913 34914 34915 34916 34917 34918

Let’s keep only the trays that we know we have:

decode <- read.csv("20240614_Annie_VIGS_1x1.xlsx - Sheet1.csv")
decode <- decode[,c(2:3,6,7)]
colnames(decode)[1] <- "tray.ID"
decode
unique(RGB$tray_id)
## NULL
RGB2 <- merge(RGB, decode, by= "tray.ID", all=T)
RGB2
unique(RGB2$measurement_name)
##   [1] "Rfid"                            "Side01_00_row1"                 
##   [3] "Side01_00_area"                  "Side01_00_height"               
##   [5] "Side01_00_width"                 "Side01_00_circularity"          
##   [7] "Side01_00_compactness"           "Side01_00_contlength"           
##   [9] "Side01_00_convexity"             "Side01_00_rectangularity"       
##  [11] "Side01_00_anisometry"            "Side01_00_bulkiness"            
##  [13] "Side01_00_struct_factor"         "Side01_00_outer_radius"         
##  [15] "Side01_00_inner_radius"          "Side01_00_dist_mean"            
##  [17] "Side01_00_dist_deviation"        "Side01_00_roundness"            
##  [19] "Side01_00_holes_num"             "Side01_00_areaInMm2"            
##  [21] "Side01_00_heightInMm"            "Side01_00_widthInMm"            
##  [23] "Side01_00_Convex_Hull_Area"      "Side01_00_AverageColor_H"       
##  [25] "Side01_00_AverageColor_S"        "Side01_00_AverageColor_V"       
##  [27] "Side01_00_CenterOfMassX"         "Side01_00_CenterOfMassY"        
##  [29] "Side01_00_CenterOfMassDistance"  "Side01_00_H_Mean"               
##  [31] "Side01_00_H_Median"              "Side01_00_H_StDev"              
##  [33] "Side01_00_H_Q1"                  "Side01_00_H_Q3"                 
##  [35] "Side01_00_brown(H_14_27)"        "Side01_00_brown-yellow(H_28_35)"
##  [37] "Side01_00_yellow(H_36_43)"       "Side01_00_yellow-green(H_44_57)"
##  [39] "Side01_00_green(H_58_99)"        "Side01_00_green-cyan(H_100_120)"
##  [41] "Side01_00_cyan-blue(H_121_142)"  "Side01_00_blue(H_143_156)"      
##  [43] "Side01_00_HistoH_0_5"            "Side01_00_HistoH_5_10"          
##  [45] "Side01_00_HistoH_10_15"          "Side01_00_HistoH_15_20"         
##  [47] "Side01_00_HistoH_20_25"          "Side01_00_HistoH_25_30"         
##  [49] "Side01_00_HistoH_30_35"          "Side01_00_HistoH_35_40"         
##  [51] "Side01_00_HistoH_40_45"          "Side01_00_HistoH_45_50"         
##  [53] "Side01_00_HistoH_50_55"          "Side01_00_HistoH_55_60"         
##  [55] "Side01_00_HistoH_60_65"          "Side01_00_HistoH_65_70"         
##  [57] "Side01_00_HistoH_70_75"          "Side01_00_HistoH_75_80"         
##  [59] "Side01_00_HistoH_80_85"          "Side01_00_HistoH_85_90"         
##  [61] "Side01_00_HistoH_90_95"          "Side01_00_HistoH_95_100"        
##  [63] "Side01_00_HistoH_100_105"        "Side01_00_HistoH_105_110"       
##  [65] "Side01_00_HistoH_110_115"        "Side01_00_HistoH_115_120"       
##  [67] "Side01_00_HistoH_120_125"        "Side01_00_HistoH_125_130"       
##  [69] "Side01_00_HistoH_130_135"        "Side01_00_HistoH_135_140"       
##  [71] "Side01_00_HistoH_140_145"        "Side01_00_HistoH_145_150"       
##  [73] "Side01_00_HistoH_150_155"        "Side01_00_HistoH_155_160"       
##  [75] "Side01_00_HistoH_160_165"        "Side01_00_HistoH_165_170"       
##  [77] "Side01_00_HistoH_170_175"        "Side01_00_HistoH_175_180"       
##  [79] "Side01_00_HistoH_180_185"        "Side01_00_HistoH_185_190"       
##  [81] "Side01_00_HistoH_190_195"        "Side01_00_HistoH_195_200"       
##  [83] "Side01_00_HistoH_200_205"        "Side01_00_HistoH_205_210"       
##  [85] "Side01_00_HistoH_210_215"        "Side01_00_HistoH_215_220"       
##  [87] "Side01_00_HistoH_220_225"        "Side01_00_HistoH_225_230"       
##  [89] "Side01_00_HistoH_230_235"        "Side01_00_HistoH_235_240"       
##  [91] "Side01_00_HistoH_240_245"        "Side01_00_HistoH_245_250"       
##  [93] "Side01_00_HistoH_250_255"        "Side01_00_Greennes_Mean"        
##  [95] "Side01_00_Greennes_Deviation"    "Side01_00_BarcodeEnabled"       
##  [97] "Side01_00_BarcodeFound"          "BarcodeResult"                  
##  [99] "Side01_01_row1"                  "Side01_01_area"                 
## [101] "Side01_01_height"                "Side01_01_width"                
## [103] "Side01_01_circularity"           "Side01_01_compactness"          
## [105] "Side01_01_contlength"            "Side01_01_convexity"            
## [107] "Side01_01_rectangularity"        "Side01_01_anisometry"           
## [109] "Side01_01_bulkiness"             "Side01_01_struct_factor"        
## [111] "Side01_01_outer_radius"          "Side01_01_inner_radius"         
## [113] "Side01_01_dist_mean"             "Side01_01_dist_deviation"       
## [115] "Side01_01_roundness"             "Side01_01_holes_num"            
## [117] "Side01_01_areaInMm2"             "Side01_01_heightInMm"           
## [119] "Side01_01_widthInMm"             "Side01_01_Convex_Hull_Area"     
## [121] "Side01_01_AverageColor_H"        "Side01_01_AverageColor_S"       
## [123] "Side01_01_AverageColor_V"        "Side01_01_CenterOfMassX"        
## [125] "Side01_01_CenterOfMassY"         "Side01_01_CenterOfMassDistance" 
## [127] "Side01_01_H_Mean"                "Side01_01_H_Median"             
## [129] "Side01_01_H_StDev"               "Side01_01_H_Q1"                 
## [131] "Side01_01_H_Q3"                  "Side01_01_brown(H_14_27)"       
## [133] "Side01_01_brown-yellow(H_28_35)" "Side01_01_yellow(H_36_43)"      
## [135] "Side01_01_yellow-green(H_44_57)" "Side01_01_green(H_58_99)"       
## [137] "Side01_01_green-cyan(H_100_120)" "Side01_01_cyan-blue(H_121_142)" 
## [139] "Side01_01_blue(H_143_156)"       "Side01_01_HistoH_0_5"           
## [141] "Side01_01_HistoH_5_10"           "Side01_01_HistoH_10_15"         
## [143] "Side01_01_HistoH_15_20"          "Side01_01_HistoH_20_25"         
## [145] "Side01_01_HistoH_25_30"          "Side01_01_HistoH_30_35"         
## [147] "Side01_01_HistoH_35_40"          "Side01_01_HistoH_40_45"         
## [149] "Side01_01_HistoH_45_50"          "Side01_01_HistoH_50_55"         
## [151] "Side01_01_HistoH_55_60"          "Side01_01_HistoH_60_65"         
## [153] "Side01_01_HistoH_65_70"          "Side01_01_HistoH_70_75"         
## [155] "Side01_01_HistoH_75_80"          "Side01_01_HistoH_80_85"         
## [157] "Side01_01_HistoH_85_90"          "Side01_01_HistoH_90_95"         
## [159] "Side01_01_HistoH_95_100"         "Side01_01_HistoH_100_105"       
## [161] "Side01_01_HistoH_105_110"        "Side01_01_HistoH_110_115"       
## [163] "Side01_01_HistoH_115_120"        "Side01_01_HistoH_120_125"       
## [165] "Side01_01_HistoH_125_130"        "Side01_01_HistoH_130_135"       
## [167] "Side01_01_HistoH_135_140"        "Side01_01_HistoH_140_145"       
## [169] "Side01_01_HistoH_145_150"        "Side01_01_HistoH_150_155"       
## [171] "Side01_01_HistoH_155_160"        "Side01_01_HistoH_160_165"       
## [173] "Side01_01_HistoH_165_170"        "Side01_01_HistoH_170_175"       
## [175] "Side01_01_HistoH_175_180"        "Side01_01_HistoH_180_185"       
## [177] "Side01_01_HistoH_185_190"        "Side01_01_HistoH_190_195"       
## [179] "Side01_01_HistoH_195_200"        "Side01_01_HistoH_200_205"       
## [181] "Side01_01_HistoH_205_210"        "Side01_01_HistoH_210_215"       
## [183] "Side01_01_HistoH_215_220"        "Side01_01_HistoH_220_225"       
## [185] "Side01_01_HistoH_225_230"        "Side01_01_HistoH_230_235"       
## [187] "Side01_01_HistoH_235_240"        "Side01_01_HistoH_240_245"       
## [189] "Side01_01_HistoH_245_250"        "Side01_01_HistoH_250_255"       
## [191] "Side01_01_Greennes_Mean"         "Side01_01_Greennes_Deviation"   
## [193] "Side01_01_BarcodeEnabled"        "Side01_01_BarcodeFound"         
## [195] "Side01_02_row1"                  "Side01_02_area"                 
## [197] "Side01_02_height"                "Side01_02_width"                
## [199] "Side01_02_circularity"           "Side01_02_compactness"          
## [201] "Side01_02_contlength"            "Side01_02_convexity"            
## [203] "Side01_02_rectangularity"        "Side01_02_anisometry"           
## [205] "Side01_02_bulkiness"             "Side01_02_struct_factor"        
## [207] "Side01_02_outer_radius"          "Side01_02_inner_radius"         
## [209] "Side01_02_dist_mean"             "Side01_02_dist_deviation"       
## [211] "Side01_02_roundness"             "Side01_02_holes_num"            
## [213] "Side01_02_areaInMm2"             "Side01_02_heightInMm"           
## [215] "Side01_02_widthInMm"             "Side01_02_Convex_Hull_Area"     
## [217] "Side01_02_AverageColor_H"        "Side01_02_AverageColor_S"       
## [219] "Side01_02_AverageColor_V"        "Side01_02_CenterOfMassX"        
## [221] "Side01_02_CenterOfMassY"         "Side01_02_CenterOfMassDistance" 
## [223] "Side01_02_H_Mean"                "Side01_02_H_Median"             
## [225] "Side01_02_H_StDev"               "Side01_02_H_Q1"                 
## [227] "Side01_02_H_Q3"                  "Side01_02_brown(H_14_27)"       
## [229] "Side01_02_brown-yellow(H_28_35)" "Side01_02_yellow(H_36_43)"      
## [231] "Side01_02_yellow-green(H_44_57)" "Side01_02_green(H_58_99)"       
## [233] "Side01_02_green-cyan(H_100_120)" "Side01_02_cyan-blue(H_121_142)" 
## [235] "Side01_02_blue(H_143_156)"       "Side01_02_HistoH_0_5"           
## [237] "Side01_02_HistoH_5_10"           "Side01_02_HistoH_10_15"         
## [239] "Side01_02_HistoH_15_20"          "Side01_02_HistoH_20_25"         
## [241] "Side01_02_HistoH_25_30"          "Side01_02_HistoH_30_35"         
## [243] "Side01_02_HistoH_35_40"          "Side01_02_HistoH_40_45"         
## [245] "Side01_02_HistoH_45_50"          "Side01_02_HistoH_50_55"         
## [247] "Side01_02_HistoH_55_60"          "Side01_02_HistoH_60_65"         
## [249] "Side01_02_HistoH_65_70"          "Side01_02_HistoH_70_75"         
## [251] "Side01_02_HistoH_75_80"          "Side01_02_HistoH_80_85"         
## [253] "Side01_02_HistoH_85_90"          "Side01_02_HistoH_90_95"         
## [255] "Side01_02_HistoH_95_100"         "Side01_02_HistoH_100_105"       
## [257] "Side01_02_HistoH_105_110"        "Side01_02_HistoH_110_115"       
## [259] "Side01_02_HistoH_115_120"        "Side01_02_HistoH_120_125"       
## [261] "Side01_02_HistoH_125_130"        "Side01_02_HistoH_130_135"       
## [263] "Side01_02_HistoH_135_140"        "Side01_02_HistoH_140_145"       
## [265] "Side01_02_HistoH_145_150"        "Side01_02_HistoH_150_155"       
## [267] "Side01_02_HistoH_155_160"        "Side01_02_HistoH_160_165"       
## [269] "Side01_02_HistoH_165_170"        "Side01_02_HistoH_170_175"       
## [271] "Side01_02_HistoH_175_180"        "Side01_02_HistoH_180_185"       
## [273] "Side01_02_HistoH_185_190"        "Side01_02_HistoH_190_195"       
## [275] "Side01_02_HistoH_195_200"        "Side01_02_HistoH_200_205"       
## [277] "Side01_02_HistoH_205_210"        "Side01_02_HistoH_210_215"       
## [279] "Side01_02_HistoH_215_220"        "Side01_02_HistoH_220_225"       
## [281] "Side01_02_HistoH_225_230"        "Side01_02_HistoH_230_235"       
## [283] "Side01_02_HistoH_235_240"        "Side01_02_HistoH_240_245"       
## [285] "Side01_02_HistoH_245_250"        "Side01_02_HistoH_250_255"       
## [287] "Side01_02_Greennes_Mean"         "Side01_02_Greennes_Deviation"   
## [289] "Side01_02_BarcodeEnabled"        "Side01_02_BarcodeFound"         
## [291] "Side01_03_row1"                  "Side01_03_area"                 
## [293] "Side01_03_height"                "Side01_03_width"                
## [295] "Side01_03_circularity"           "Side01_03_compactness"          
## [297] "Side01_03_contlength"            "Side01_03_convexity"            
## [299] "Side01_03_rectangularity"        "Side01_03_anisometry"           
## [301] "Side01_03_bulkiness"             "Side01_03_struct_factor"        
## [303] "Side01_03_outer_radius"          "Side01_03_inner_radius"         
## [305] "Side01_03_dist_mean"             "Side01_03_dist_deviation"       
## [307] "Side01_03_roundness"             "Side01_03_holes_num"            
## [309] "Side01_03_areaInMm2"             "Side01_03_heightInMm"           
## [311] "Side01_03_widthInMm"             "Side01_03_Convex_Hull_Area"     
## [313] "Side01_03_AverageColor_H"        "Side01_03_AverageColor_S"       
## [315] "Side01_03_AverageColor_V"        "Side01_03_CenterOfMassX"        
## [317] "Side01_03_CenterOfMassY"         "Side01_03_CenterOfMassDistance" 
## [319] "Side01_03_H_Mean"                "Side01_03_H_Median"             
## [321] "Side01_03_H_StDev"               "Side01_03_H_Q1"                 
## [323] "Side01_03_H_Q3"                  "Side01_03_brown(H_14_27)"       
## [325] "Side01_03_brown-yellow(H_28_35)" "Side01_03_yellow(H_36_43)"      
## [327] "Side01_03_yellow-green(H_44_57)" "Side01_03_green(H_58_99)"       
## [329] "Side01_03_green-cyan(H_100_120)" "Side01_03_cyan-blue(H_121_142)" 
## [331] "Side01_03_blue(H_143_156)"       "Side01_03_HistoH_0_5"           
## [333] "Side01_03_HistoH_5_10"           "Side01_03_HistoH_10_15"         
## [335] "Side01_03_HistoH_15_20"          "Side01_03_HistoH_20_25"         
## [337] "Side01_03_HistoH_25_30"          "Side01_03_HistoH_30_35"         
## [339] "Side01_03_HistoH_35_40"          "Side01_03_HistoH_40_45"         
## [341] "Side01_03_HistoH_45_50"          "Side01_03_HistoH_50_55"         
## [343] "Side01_03_HistoH_55_60"          "Side01_03_HistoH_60_65"         
## [345] "Side01_03_HistoH_65_70"          "Side01_03_HistoH_70_75"         
## [347] "Side01_03_HistoH_75_80"          "Side01_03_HistoH_80_85"         
## [349] "Side01_03_HistoH_85_90"          "Side01_03_HistoH_90_95"         
## [351] "Side01_03_HistoH_95_100"         "Side01_03_HistoH_100_105"       
## [353] "Side01_03_HistoH_105_110"        "Side01_03_HistoH_110_115"       
## [355] "Side01_03_HistoH_115_120"        "Side01_03_HistoH_120_125"       
## [357] "Side01_03_HistoH_125_130"        "Side01_03_HistoH_130_135"       
## [359] "Side01_03_HistoH_135_140"        "Side01_03_HistoH_140_145"       
## [361] "Side01_03_HistoH_145_150"        "Side01_03_HistoH_150_155"       
## [363] "Side01_03_HistoH_155_160"        "Side01_03_HistoH_160_165"       
## [365] "Side01_03_HistoH_165_170"        "Side01_03_HistoH_170_175"       
## [367] "Side01_03_HistoH_175_180"        "Side01_03_HistoH_180_185"       
## [369] "Side01_03_HistoH_185_190"        "Side01_03_HistoH_190_195"       
## [371] "Side01_03_HistoH_195_200"        "Side01_03_HistoH_200_205"       
## [373] "Side01_03_HistoH_205_210"        "Side01_03_HistoH_210_215"       
## [375] "Side01_03_HistoH_215_220"        "Side01_03_HistoH_220_225"       
## [377] "Side01_03_HistoH_225_230"        "Side01_03_HistoH_230_235"       
## [379] "Side01_03_HistoH_235_240"        "Side01_03_HistoH_240_245"       
## [381] "Side01_03_HistoH_245_250"        "Side01_03_HistoH_250_255"       
## [383] "Side01_03_Greennes_Mean"         "Side01_03_Greennes_Deviation"   
## [385] "Side01_03_BarcodeEnabled"        "Side01_03_BarcodeFound"         
## [387] "Side01_04_row1"                  "Side01_04_area"                 
## [389] "Side01_04_height"                "Side01_04_width"                
## [391] "Side01_04_circularity"           "Side01_04_compactness"          
## [393] "Side01_04_contlength"            "Side01_04_convexity"            
## [395] "Side01_04_rectangularity"        "Side01_04_anisometry"           
## [397] "Side01_04_bulkiness"             "Side01_04_struct_factor"        
## [399] "Side01_04_outer_radius"          "Side01_04_inner_radius"         
## [401] "Side01_04_dist_mean"             "Side01_04_dist_deviation"       
## [403] "Side01_04_roundness"             "Side01_04_holes_num"            
## [405] "Side01_04_areaInMm2"             "Side01_04_heightInMm"           
## [407] "Side01_04_widthInMm"             "Side01_04_Convex_Hull_Area"     
## [409] "Side01_04_AverageColor_H"        "Side01_04_AverageColor_S"       
## [411] "Side01_04_AverageColor_V"        "Side01_04_CenterOfMassX"        
## [413] "Side01_04_CenterOfMassY"         "Side01_04_CenterOfMassDistance" 
## [415] "Side01_04_H_Mean"                "Side01_04_H_Median"             
## [417] "Side01_04_H_StDev"               "Side01_04_H_Q1"                 
## [419] "Side01_04_H_Q3"                  "Side01_04_brown(H_14_27)"       
## [421] "Side01_04_brown-yellow(H_28_35)" "Side01_04_yellow(H_36_43)"      
## [423] "Side01_04_yellow-green(H_44_57)" "Side01_04_green(H_58_99)"       
## [425] "Side01_04_green-cyan(H_100_120)" "Side01_04_cyan-blue(H_121_142)" 
## [427] "Side01_04_blue(H_143_156)"       "Side01_04_HistoH_0_5"           
## [429] "Side01_04_HistoH_5_10"           "Side01_04_HistoH_10_15"         
## [431] "Side01_04_HistoH_15_20"          "Side01_04_HistoH_20_25"         
## [433] "Side01_04_HistoH_25_30"          "Side01_04_HistoH_30_35"         
## [435] "Side01_04_HistoH_35_40"          "Side01_04_HistoH_40_45"         
## [437] "Side01_04_HistoH_45_50"          "Side01_04_HistoH_50_55"         
## [439] "Side01_04_HistoH_55_60"          "Side01_04_HistoH_60_65"         
## [441] "Side01_04_HistoH_65_70"          "Side01_04_HistoH_70_75"         
## [443] "Side01_04_HistoH_75_80"          "Side01_04_HistoH_80_85"         
## [445] "Side01_04_HistoH_85_90"          "Side01_04_HistoH_90_95"         
## [447] "Side01_04_HistoH_95_100"         "Side01_04_HistoH_100_105"       
## [449] "Side01_04_HistoH_105_110"        "Side01_04_HistoH_110_115"       
## [451] "Side01_04_HistoH_115_120"        "Side01_04_HistoH_120_125"       
## [453] "Side01_04_HistoH_125_130"        "Side01_04_HistoH_130_135"       
## [455] "Side01_04_HistoH_135_140"        "Side01_04_HistoH_140_145"       
## [457] "Side01_04_HistoH_145_150"        "Side01_04_HistoH_150_155"       
## [459] "Side01_04_HistoH_155_160"        "Side01_04_HistoH_160_165"       
## [461] "Side01_04_HistoH_165_170"        "Side01_04_HistoH_170_175"       
## [463] "Side01_04_HistoH_175_180"        "Side01_04_HistoH_180_185"       
## [465] "Side01_04_HistoH_185_190"        "Side01_04_HistoH_190_195"       
## [467] "Side01_04_HistoH_195_200"        "Side01_04_HistoH_200_205"       
## [469] "Side01_04_HistoH_205_210"        "Side01_04_HistoH_210_215"       
## [471] "Side01_04_HistoH_215_220"        "Side01_04_HistoH_220_225"       
## [473] "Side01_04_HistoH_225_230"        "Side01_04_HistoH_230_235"       
## [475] "Side01_04_HistoH_235_240"        "Side01_04_HistoH_240_245"       
## [477] "Side01_04_HistoH_245_250"        "Side01_04_HistoH_250_255"       
## [479] "Side01_04_Greennes_Mean"         "Side01_04_Greennes_Deviation"   
## [481] "Side01_04_BarcodeEnabled"        "Side01_04_BarcodeFound"         
## [483] "Side01_05_row1"                  "Side01_05_area"                 
## [485] "Side01_05_height"                "Side01_05_width"                
## [487] "Side01_05_circularity"           "Side01_05_compactness"          
## [489] "Side01_05_contlength"            "Side01_05_convexity"            
## [491] "Side01_05_rectangularity"        "Side01_05_anisometry"           
## [493] "Side01_05_bulkiness"             "Side01_05_struct_factor"        
## [495] "Side01_05_outer_radius"          "Side01_05_inner_radius"         
## [497] "Side01_05_dist_mean"             "Side01_05_dist_deviation"       
## [499] "Side01_05_roundness"             "Side01_05_holes_num"            
## [501] "Side01_05_areaInMm2"             "Side01_05_heightInMm"           
## [503] "Side01_05_widthInMm"             "Side01_05_Convex_Hull_Area"     
## [505] "Side01_05_AverageColor_H"        "Side01_05_AverageColor_S"       
## [507] "Side01_05_AverageColor_V"        "Side01_05_CenterOfMassX"        
## [509] "Side01_05_CenterOfMassY"         "Side01_05_CenterOfMassDistance" 
## [511] "Side01_05_H_Mean"                "Side01_05_H_Median"             
## [513] "Side01_05_H_StDev"               "Side01_05_H_Q1"                 
## [515] "Side01_05_H_Q3"                  "Side01_05_brown(H_14_27)"       
## [517] "Side01_05_brown-yellow(H_28_35)" "Side01_05_yellow(H_36_43)"      
## [519] "Side01_05_yellow-green(H_44_57)" "Side01_05_green(H_58_99)"       
## [521] "Side01_05_green-cyan(H_100_120)" "Side01_05_cyan-blue(H_121_142)" 
## [523] "Side01_05_blue(H_143_156)"       "Side01_05_HistoH_0_5"           
## [525] "Side01_05_HistoH_5_10"           "Side01_05_HistoH_10_15"         
## [527] "Side01_05_HistoH_15_20"          "Side01_05_HistoH_20_25"         
## [529] "Side01_05_HistoH_25_30"          "Side01_05_HistoH_30_35"         
## [531] "Side01_05_HistoH_35_40"          "Side01_05_HistoH_40_45"         
## [533] "Side01_05_HistoH_45_50"          "Side01_05_HistoH_50_55"         
## [535] "Side01_05_HistoH_55_60"          "Side01_05_HistoH_60_65"         
## [537] "Side01_05_HistoH_65_70"          "Side01_05_HistoH_70_75"         
## [539] "Side01_05_HistoH_75_80"          "Side01_05_HistoH_80_85"         
## [541] "Side01_05_HistoH_85_90"          "Side01_05_HistoH_90_95"         
## [543] "Side01_05_HistoH_95_100"         "Side01_05_HistoH_100_105"       
## [545] "Side01_05_HistoH_105_110"        "Side01_05_HistoH_110_115"       
## [547] "Side01_05_HistoH_115_120"        "Side01_05_HistoH_120_125"       
## [549] "Side01_05_HistoH_125_130"        "Side01_05_HistoH_130_135"       
## [551] "Side01_05_HistoH_135_140"        "Side01_05_HistoH_140_145"       
## [553] "Side01_05_HistoH_145_150"        "Side01_05_HistoH_150_155"       
## [555] "Side01_05_HistoH_155_160"        "Side01_05_HistoH_160_165"       
## [557] "Side01_05_HistoH_165_170"        "Side01_05_HistoH_170_175"       
## [559] "Side01_05_HistoH_175_180"        "Side01_05_HistoH_180_185"       
## [561] "Side01_05_HistoH_185_190"        "Side01_05_HistoH_190_195"       
## [563] "Side01_05_HistoH_195_200"        "Side01_05_HistoH_200_205"       
## [565] "Side01_05_HistoH_205_210"        "Side01_05_HistoH_210_215"       
## [567] "Side01_05_HistoH_215_220"        "Side01_05_HistoH_220_225"       
## [569] "Side01_05_HistoH_225_230"        "Side01_05_HistoH_230_235"       
## [571] "Side01_05_HistoH_235_240"        "Side01_05_HistoH_240_245"       
## [573] "Side01_05_HistoH_245_250"        "Side01_05_HistoH_250_255"       
## [575] "Side01_05_Greennes_Mean"         "Side01_05_Greennes_Deviation"   
## [577] "Side01_05_BarcodeEnabled"        "Side01_05_BarcodeFound"         
## [579] "row1"                            "area"                           
## [581] "height"                          "width"                          
## [583] "circularity"                     "compactness"                    
## [585] "contlength"                      "convexity"                      
## [587] "rectangularity"                  "anisometry"                     
## [589] "bulkiness"                       "struct_factor"                  
## [591] "outer_radius"                    "inner_radius"                   
## [593] "dist_mean"                       "dist_deviation"                 
## [595] "roundness"                       "holes_num"                      
## [597] "areaInMm2"                       "heightInMm"                     
## [599] "widthInMm"                       "Convex_Hull_Area"               
## [601] "AverageColor_H"                  "AverageColor_S"                 
## [603] "AverageColor_V"                  "CenterOfMassX"                  
## [605] "CenterOfMassY"                   "CenterOfMassDistance"           
## [607] "H_Mean"                          "H_Median"                       
## [609] "H_StDev"                         "H_Q1"                           
## [611] "H_Q3"                            "brown(H_14_27)"                 
## [613] "brown-yellow(H_28_35)"           "yellow(H_36_43)"                
## [615] "yellow-green(H_44_57)"           "green(H_58_99)"                 
## [617] "green-cyan(H_100_120)"           "cyan-blue(H_121_142)"           
## [619] "blue(H_143_156)"                 "HistoH_0_5"                     
## [621] "HistoH_5_10"                     "HistoH_10_15"                   
## [623] "HistoH_15_20"                    "HistoH_20_25"                   
## [625] "HistoH_25_30"                    "HistoH_30_35"                   
## [627] "HistoH_35_40"                    "HistoH_40_45"                   
## [629] "HistoH_45_50"                    "HistoH_50_55"                   
## [631] "HistoH_55_60"                    "HistoH_60_65"                   
## [633] "HistoH_65_70"                    "HistoH_70_75"                   
## [635] "HistoH_75_80"                    "HistoH_80_85"                   
## [637] "HistoH_85_90"                    "HistoH_90_95"                   
## [639] "HistoH_95_100"                   "HistoH_100_105"                 
## [641] "HistoH_105_110"                  "HistoH_110_115"                 
## [643] "HistoH_115_120"                  "HistoH_120_125"                 
## [645] "HistoH_125_130"                  "HistoH_130_135"                 
## [647] "HistoH_135_140"                  "HistoH_140_145"                 
## [649] "HistoH_145_150"                  "HistoH_150_155"                 
## [651] "HistoH_155_160"                  "HistoH_160_165"                 
## [653] "HistoH_165_170"                  "HistoH_170_175"                 
## [655] "HistoH_175_180"                  "HistoH_180_185"                 
## [657] "HistoH_185_190"                  "HistoH_190_195"                 
## [659] "HistoH_195_200"                  "HistoH_200_205"                 
## [661] "HistoH_205_210"                  "HistoH_210_215"                 
## [663] "HistoH_215_220"                  "HistoH_220_225"                 
## [665] "HistoH_225_230"                  "HistoH_230_235"                 
## [667] "HistoH_235_240"                  "HistoH_240_245"                 
## [669] "HistoH_245_250"                  "HistoH_250_255"                 
## [671] "Greennes_Mean"                   "Greennes_Deviation"             
## [673] "BarcodeEnabled"                  "BarcodeFound"

Let’s isolate only the area data for now - to see what we get from this:

unique(RGB$measurement_name)
##   [1] "Rfid"                            "Side01_00_row1"                 
##   [3] "Side01_00_area"                  "Side01_00_height"               
##   [5] "Side01_00_width"                 "Side01_00_circularity"          
##   [7] "Side01_00_compactness"           "Side01_00_contlength"           
##   [9] "Side01_00_convexity"             "Side01_00_rectangularity"       
##  [11] "Side01_00_anisometry"            "Side01_00_bulkiness"            
##  [13] "Side01_00_struct_factor"         "Side01_00_outer_radius"         
##  [15] "Side01_00_inner_radius"          "Side01_00_dist_mean"            
##  [17] "Side01_00_dist_deviation"        "Side01_00_roundness"            
##  [19] "Side01_00_holes_num"             "Side01_00_areaInMm2"            
##  [21] "Side01_00_heightInMm"            "Side01_00_widthInMm"            
##  [23] "Side01_00_Convex_Hull_Area"      "Side01_00_AverageColor_H"       
##  [25] "Side01_00_AverageColor_S"        "Side01_00_AverageColor_V"       
##  [27] "Side01_00_CenterOfMassX"         "Side01_00_CenterOfMassY"        
##  [29] "Side01_00_CenterOfMassDistance"  "Side01_00_H_Mean"               
##  [31] "Side01_00_H_Median"              "Side01_00_H_StDev"              
##  [33] "Side01_00_H_Q1"                  "Side01_00_H_Q3"                 
##  [35] "Side01_00_brown(H_14_27)"        "Side01_00_brown-yellow(H_28_35)"
##  [37] "Side01_00_yellow(H_36_43)"       "Side01_00_yellow-green(H_44_57)"
##  [39] "Side01_00_green(H_58_99)"        "Side01_00_green-cyan(H_100_120)"
##  [41] "Side01_00_cyan-blue(H_121_142)"  "Side01_00_blue(H_143_156)"      
##  [43] "Side01_00_HistoH_0_5"            "Side01_00_HistoH_5_10"          
##  [45] "Side01_00_HistoH_10_15"          "Side01_00_HistoH_15_20"         
##  [47] "Side01_00_HistoH_20_25"          "Side01_00_HistoH_25_30"         
##  [49] "Side01_00_HistoH_30_35"          "Side01_00_HistoH_35_40"         
##  [51] "Side01_00_HistoH_40_45"          "Side01_00_HistoH_45_50"         
##  [53] "Side01_00_HistoH_50_55"          "Side01_00_HistoH_55_60"         
##  [55] "Side01_00_HistoH_60_65"          "Side01_00_HistoH_65_70"         
##  [57] "Side01_00_HistoH_70_75"          "Side01_00_HistoH_75_80"         
##  [59] "Side01_00_HistoH_80_85"          "Side01_00_HistoH_85_90"         
##  [61] "Side01_00_HistoH_90_95"          "Side01_00_HistoH_95_100"        
##  [63] "Side01_00_HistoH_100_105"        "Side01_00_HistoH_105_110"       
##  [65] "Side01_00_HistoH_110_115"        "Side01_00_HistoH_115_120"       
##  [67] "Side01_00_HistoH_120_125"        "Side01_00_HistoH_125_130"       
##  [69] "Side01_00_HistoH_130_135"        "Side01_00_HistoH_135_140"       
##  [71] "Side01_00_HistoH_140_145"        "Side01_00_HistoH_145_150"       
##  [73] "Side01_00_HistoH_150_155"        "Side01_00_HistoH_155_160"       
##  [75] "Side01_00_HistoH_160_165"        "Side01_00_HistoH_165_170"       
##  [77] "Side01_00_HistoH_170_175"        "Side01_00_HistoH_175_180"       
##  [79] "Side01_00_HistoH_180_185"        "Side01_00_HistoH_185_190"       
##  [81] "Side01_00_HistoH_190_195"        "Side01_00_HistoH_195_200"       
##  [83] "Side01_00_HistoH_200_205"        "Side01_00_HistoH_205_210"       
##  [85] "Side01_00_HistoH_210_215"        "Side01_00_HistoH_215_220"       
##  [87] "Side01_00_HistoH_220_225"        "Side01_00_HistoH_225_230"       
##  [89] "Side01_00_HistoH_230_235"        "Side01_00_HistoH_235_240"       
##  [91] "Side01_00_HistoH_240_245"        "Side01_00_HistoH_245_250"       
##  [93] "Side01_00_HistoH_250_255"        "Side01_00_Greennes_Mean"        
##  [95] "Side01_00_Greennes_Deviation"    "Side01_00_BarcodeEnabled"       
##  [97] "Side01_00_BarcodeFound"          "BarcodeResult"                  
##  [99] "Side01_01_row1"                  "Side01_01_area"                 
## [101] "Side01_01_height"                "Side01_01_width"                
## [103] "Side01_01_circularity"           "Side01_01_compactness"          
## [105] "Side01_01_contlength"            "Side01_01_convexity"            
## [107] "Side01_01_rectangularity"        "Side01_01_anisometry"           
## [109] "Side01_01_bulkiness"             "Side01_01_struct_factor"        
## [111] "Side01_01_outer_radius"          "Side01_01_inner_radius"         
## [113] "Side01_01_dist_mean"             "Side01_01_dist_deviation"       
## [115] "Side01_01_roundness"             "Side01_01_holes_num"            
## [117] "Side01_01_areaInMm2"             "Side01_01_heightInMm"           
## [119] "Side01_01_widthInMm"             "Side01_01_Convex_Hull_Area"     
## [121] "Side01_01_AverageColor_H"        "Side01_01_AverageColor_S"       
## [123] "Side01_01_AverageColor_V"        "Side01_01_CenterOfMassX"        
## [125] "Side01_01_CenterOfMassY"         "Side01_01_CenterOfMassDistance" 
## [127] "Side01_01_H_Mean"                "Side01_01_H_Median"             
## [129] "Side01_01_H_StDev"               "Side01_01_H_Q1"                 
## [131] "Side01_01_H_Q3"                  "Side01_01_brown(H_14_27)"       
## [133] "Side01_01_brown-yellow(H_28_35)" "Side01_01_yellow(H_36_43)"      
## [135] "Side01_01_yellow-green(H_44_57)" "Side01_01_green(H_58_99)"       
## [137] "Side01_01_green-cyan(H_100_120)" "Side01_01_cyan-blue(H_121_142)" 
## [139] "Side01_01_blue(H_143_156)"       "Side01_01_HistoH_0_5"           
## [141] "Side01_01_HistoH_5_10"           "Side01_01_HistoH_10_15"         
## [143] "Side01_01_HistoH_15_20"          "Side01_01_HistoH_20_25"         
## [145] "Side01_01_HistoH_25_30"          "Side01_01_HistoH_30_35"         
## [147] "Side01_01_HistoH_35_40"          "Side01_01_HistoH_40_45"         
## [149] "Side01_01_HistoH_45_50"          "Side01_01_HistoH_50_55"         
## [151] "Side01_01_HistoH_55_60"          "Side01_01_HistoH_60_65"         
## [153] "Side01_01_HistoH_65_70"          "Side01_01_HistoH_70_75"         
## [155] "Side01_01_HistoH_75_80"          "Side01_01_HistoH_80_85"         
## [157] "Side01_01_HistoH_85_90"          "Side01_01_HistoH_90_95"         
## [159] "Side01_01_HistoH_95_100"         "Side01_01_HistoH_100_105"       
## [161] "Side01_01_HistoH_105_110"        "Side01_01_HistoH_110_115"       
## [163] "Side01_01_HistoH_115_120"        "Side01_01_HistoH_120_125"       
## [165] "Side01_01_HistoH_125_130"        "Side01_01_HistoH_130_135"       
## [167] "Side01_01_HistoH_135_140"        "Side01_01_HistoH_140_145"       
## [169] "Side01_01_HistoH_145_150"        "Side01_01_HistoH_150_155"       
## [171] "Side01_01_HistoH_155_160"        "Side01_01_HistoH_160_165"       
## [173] "Side01_01_HistoH_165_170"        "Side01_01_HistoH_170_175"       
## [175] "Side01_01_HistoH_175_180"        "Side01_01_HistoH_180_185"       
## [177] "Side01_01_HistoH_185_190"        "Side01_01_HistoH_190_195"       
## [179] "Side01_01_HistoH_195_200"        "Side01_01_HistoH_200_205"       
## [181] "Side01_01_HistoH_205_210"        "Side01_01_HistoH_210_215"       
## [183] "Side01_01_HistoH_215_220"        "Side01_01_HistoH_220_225"       
## [185] "Side01_01_HistoH_225_230"        "Side01_01_HistoH_230_235"       
## [187] "Side01_01_HistoH_235_240"        "Side01_01_HistoH_240_245"       
## [189] "Side01_01_HistoH_245_250"        "Side01_01_HistoH_250_255"       
## [191] "Side01_01_Greennes_Mean"         "Side01_01_Greennes_Deviation"   
## [193] "Side01_01_BarcodeEnabled"        "Side01_01_BarcodeFound"         
## [195] "Side01_02_row1"                  "Side01_02_area"                 
## [197] "Side01_02_height"                "Side01_02_width"                
## [199] "Side01_02_circularity"           "Side01_02_compactness"          
## [201] "Side01_02_contlength"            "Side01_02_convexity"            
## [203] "Side01_02_rectangularity"        "Side01_02_anisometry"           
## [205] "Side01_02_bulkiness"             "Side01_02_struct_factor"        
## [207] "Side01_02_outer_radius"          "Side01_02_inner_radius"         
## [209] "Side01_02_dist_mean"             "Side01_02_dist_deviation"       
## [211] "Side01_02_roundness"             "Side01_02_holes_num"            
## [213] "Side01_02_areaInMm2"             "Side01_02_heightInMm"           
## [215] "Side01_02_widthInMm"             "Side01_02_Convex_Hull_Area"     
## [217] "Side01_02_AverageColor_H"        "Side01_02_AverageColor_S"       
## [219] "Side01_02_AverageColor_V"        "Side01_02_CenterOfMassX"        
## [221] "Side01_02_CenterOfMassY"         "Side01_02_CenterOfMassDistance" 
## [223] "Side01_02_H_Mean"                "Side01_02_H_Median"             
## [225] "Side01_02_H_StDev"               "Side01_02_H_Q1"                 
## [227] "Side01_02_H_Q3"                  "Side01_02_brown(H_14_27)"       
## [229] "Side01_02_brown-yellow(H_28_35)" "Side01_02_yellow(H_36_43)"      
## [231] "Side01_02_yellow-green(H_44_57)" "Side01_02_green(H_58_99)"       
## [233] "Side01_02_green-cyan(H_100_120)" "Side01_02_cyan-blue(H_121_142)" 
## [235] "Side01_02_blue(H_143_156)"       "Side01_02_HistoH_0_5"           
## [237] "Side01_02_HistoH_5_10"           "Side01_02_HistoH_10_15"         
## [239] "Side01_02_HistoH_15_20"          "Side01_02_HistoH_20_25"         
## [241] "Side01_02_HistoH_25_30"          "Side01_02_HistoH_30_35"         
## [243] "Side01_02_HistoH_35_40"          "Side01_02_HistoH_40_45"         
## [245] "Side01_02_HistoH_45_50"          "Side01_02_HistoH_50_55"         
## [247] "Side01_02_HistoH_55_60"          "Side01_02_HistoH_60_65"         
## [249] "Side01_02_HistoH_65_70"          "Side01_02_HistoH_70_75"         
## [251] "Side01_02_HistoH_75_80"          "Side01_02_HistoH_80_85"         
## [253] "Side01_02_HistoH_85_90"          "Side01_02_HistoH_90_95"         
## [255] "Side01_02_HistoH_95_100"         "Side01_02_HistoH_100_105"       
## [257] "Side01_02_HistoH_105_110"        "Side01_02_HistoH_110_115"       
## [259] "Side01_02_HistoH_115_120"        "Side01_02_HistoH_120_125"       
## [261] "Side01_02_HistoH_125_130"        "Side01_02_HistoH_130_135"       
## [263] "Side01_02_HistoH_135_140"        "Side01_02_HistoH_140_145"       
## [265] "Side01_02_HistoH_145_150"        "Side01_02_HistoH_150_155"       
## [267] "Side01_02_HistoH_155_160"        "Side01_02_HistoH_160_165"       
## [269] "Side01_02_HistoH_165_170"        "Side01_02_HistoH_170_175"       
## [271] "Side01_02_HistoH_175_180"        "Side01_02_HistoH_180_185"       
## [273] "Side01_02_HistoH_185_190"        "Side01_02_HistoH_190_195"       
## [275] "Side01_02_HistoH_195_200"        "Side01_02_HistoH_200_205"       
## [277] "Side01_02_HistoH_205_210"        "Side01_02_HistoH_210_215"       
## [279] "Side01_02_HistoH_215_220"        "Side01_02_HistoH_220_225"       
## [281] "Side01_02_HistoH_225_230"        "Side01_02_HistoH_230_235"       
## [283] "Side01_02_HistoH_235_240"        "Side01_02_HistoH_240_245"       
## [285] "Side01_02_HistoH_245_250"        "Side01_02_HistoH_250_255"       
## [287] "Side01_02_Greennes_Mean"         "Side01_02_Greennes_Deviation"   
## [289] "Side01_02_BarcodeEnabled"        "Side01_02_BarcodeFound"         
## [291] "Side01_03_row1"                  "Side01_03_area"                 
## [293] "Side01_03_height"                "Side01_03_width"                
## [295] "Side01_03_circularity"           "Side01_03_compactness"          
## [297] "Side01_03_contlength"            "Side01_03_convexity"            
## [299] "Side01_03_rectangularity"        "Side01_03_anisometry"           
## [301] "Side01_03_bulkiness"             "Side01_03_struct_factor"        
## [303] "Side01_03_outer_radius"          "Side01_03_inner_radius"         
## [305] "Side01_03_dist_mean"             "Side01_03_dist_deviation"       
## [307] "Side01_03_roundness"             "Side01_03_holes_num"            
## [309] "Side01_03_areaInMm2"             "Side01_03_heightInMm"           
## [311] "Side01_03_widthInMm"             "Side01_03_Convex_Hull_Area"     
## [313] "Side01_03_AverageColor_H"        "Side01_03_AverageColor_S"       
## [315] "Side01_03_AverageColor_V"        "Side01_03_CenterOfMassX"        
## [317] "Side01_03_CenterOfMassY"         "Side01_03_CenterOfMassDistance" 
## [319] "Side01_03_H_Mean"                "Side01_03_H_Median"             
## [321] "Side01_03_H_StDev"               "Side01_03_H_Q1"                 
## [323] "Side01_03_H_Q3"                  "Side01_03_brown(H_14_27)"       
## [325] "Side01_03_brown-yellow(H_28_35)" "Side01_03_yellow(H_36_43)"      
## [327] "Side01_03_yellow-green(H_44_57)" "Side01_03_green(H_58_99)"       
## [329] "Side01_03_green-cyan(H_100_120)" "Side01_03_cyan-blue(H_121_142)" 
## [331] "Side01_03_blue(H_143_156)"       "Side01_03_HistoH_0_5"           
## [333] "Side01_03_HistoH_5_10"           "Side01_03_HistoH_10_15"         
## [335] "Side01_03_HistoH_15_20"          "Side01_03_HistoH_20_25"         
## [337] "Side01_03_HistoH_25_30"          "Side01_03_HistoH_30_35"         
## [339] "Side01_03_HistoH_35_40"          "Side01_03_HistoH_40_45"         
## [341] "Side01_03_HistoH_45_50"          "Side01_03_HistoH_50_55"         
## [343] "Side01_03_HistoH_55_60"          "Side01_03_HistoH_60_65"         
## [345] "Side01_03_HistoH_65_70"          "Side01_03_HistoH_70_75"         
## [347] "Side01_03_HistoH_75_80"          "Side01_03_HistoH_80_85"         
## [349] "Side01_03_HistoH_85_90"          "Side01_03_HistoH_90_95"         
## [351] "Side01_03_HistoH_95_100"         "Side01_03_HistoH_100_105"       
## [353] "Side01_03_HistoH_105_110"        "Side01_03_HistoH_110_115"       
## [355] "Side01_03_HistoH_115_120"        "Side01_03_HistoH_120_125"       
## [357] "Side01_03_HistoH_125_130"        "Side01_03_HistoH_130_135"       
## [359] "Side01_03_HistoH_135_140"        "Side01_03_HistoH_140_145"       
## [361] "Side01_03_HistoH_145_150"        "Side01_03_HistoH_150_155"       
## [363] "Side01_03_HistoH_155_160"        "Side01_03_HistoH_160_165"       
## [365] "Side01_03_HistoH_165_170"        "Side01_03_HistoH_170_175"       
## [367] "Side01_03_HistoH_175_180"        "Side01_03_HistoH_180_185"       
## [369] "Side01_03_HistoH_185_190"        "Side01_03_HistoH_190_195"       
## [371] "Side01_03_HistoH_195_200"        "Side01_03_HistoH_200_205"       
## [373] "Side01_03_HistoH_205_210"        "Side01_03_HistoH_210_215"       
## [375] "Side01_03_HistoH_215_220"        "Side01_03_HistoH_220_225"       
## [377] "Side01_03_HistoH_225_230"        "Side01_03_HistoH_230_235"       
## [379] "Side01_03_HistoH_235_240"        "Side01_03_HistoH_240_245"       
## [381] "Side01_03_HistoH_245_250"        "Side01_03_HistoH_250_255"       
## [383] "Side01_03_Greennes_Mean"         "Side01_03_Greennes_Deviation"   
## [385] "Side01_03_BarcodeEnabled"        "Side01_03_BarcodeFound"         
## [387] "Side01_04_row1"                  "Side01_04_area"                 
## [389] "Side01_04_height"                "Side01_04_width"                
## [391] "Side01_04_circularity"           "Side01_04_compactness"          
## [393] "Side01_04_contlength"            "Side01_04_convexity"            
## [395] "Side01_04_rectangularity"        "Side01_04_anisometry"           
## [397] "Side01_04_bulkiness"             "Side01_04_struct_factor"        
## [399] "Side01_04_outer_radius"          "Side01_04_inner_radius"         
## [401] "Side01_04_dist_mean"             "Side01_04_dist_deviation"       
## [403] "Side01_04_roundness"             "Side01_04_holes_num"            
## [405] "Side01_04_areaInMm2"             "Side01_04_heightInMm"           
## [407] "Side01_04_widthInMm"             "Side01_04_Convex_Hull_Area"     
## [409] "Side01_04_AverageColor_H"        "Side01_04_AverageColor_S"       
## [411] "Side01_04_AverageColor_V"        "Side01_04_CenterOfMassX"        
## [413] "Side01_04_CenterOfMassY"         "Side01_04_CenterOfMassDistance" 
## [415] "Side01_04_H_Mean"                "Side01_04_H_Median"             
## [417] "Side01_04_H_StDev"               "Side01_04_H_Q1"                 
## [419] "Side01_04_H_Q3"                  "Side01_04_brown(H_14_27)"       
## [421] "Side01_04_brown-yellow(H_28_35)" "Side01_04_yellow(H_36_43)"      
## [423] "Side01_04_yellow-green(H_44_57)" "Side01_04_green(H_58_99)"       
## [425] "Side01_04_green-cyan(H_100_120)" "Side01_04_cyan-blue(H_121_142)" 
## [427] "Side01_04_blue(H_143_156)"       "Side01_04_HistoH_0_5"           
## [429] "Side01_04_HistoH_5_10"           "Side01_04_HistoH_10_15"         
## [431] "Side01_04_HistoH_15_20"          "Side01_04_HistoH_20_25"         
## [433] "Side01_04_HistoH_25_30"          "Side01_04_HistoH_30_35"         
## [435] "Side01_04_HistoH_35_40"          "Side01_04_HistoH_40_45"         
## [437] "Side01_04_HistoH_45_50"          "Side01_04_HistoH_50_55"         
## [439] "Side01_04_HistoH_55_60"          "Side01_04_HistoH_60_65"         
## [441] "Side01_04_HistoH_65_70"          "Side01_04_HistoH_70_75"         
## [443] "Side01_04_HistoH_75_80"          "Side01_04_HistoH_80_85"         
## [445] "Side01_04_HistoH_85_90"          "Side01_04_HistoH_90_95"         
## [447] "Side01_04_HistoH_95_100"         "Side01_04_HistoH_100_105"       
## [449] "Side01_04_HistoH_105_110"        "Side01_04_HistoH_110_115"       
## [451] "Side01_04_HistoH_115_120"        "Side01_04_HistoH_120_125"       
## [453] "Side01_04_HistoH_125_130"        "Side01_04_HistoH_130_135"       
## [455] "Side01_04_HistoH_135_140"        "Side01_04_HistoH_140_145"       
## [457] "Side01_04_HistoH_145_150"        "Side01_04_HistoH_150_155"       
## [459] "Side01_04_HistoH_155_160"        "Side01_04_HistoH_160_165"       
## [461] "Side01_04_HistoH_165_170"        "Side01_04_HistoH_170_175"       
## [463] "Side01_04_HistoH_175_180"        "Side01_04_HistoH_180_185"       
## [465] "Side01_04_HistoH_185_190"        "Side01_04_HistoH_190_195"       
## [467] "Side01_04_HistoH_195_200"        "Side01_04_HistoH_200_205"       
## [469] "Side01_04_HistoH_205_210"        "Side01_04_HistoH_210_215"       
## [471] "Side01_04_HistoH_215_220"        "Side01_04_HistoH_220_225"       
## [473] "Side01_04_HistoH_225_230"        "Side01_04_HistoH_230_235"       
## [475] "Side01_04_HistoH_235_240"        "Side01_04_HistoH_240_245"       
## [477] "Side01_04_HistoH_245_250"        "Side01_04_HistoH_250_255"       
## [479] "Side01_04_Greennes_Mean"         "Side01_04_Greennes_Deviation"   
## [481] "Side01_04_BarcodeEnabled"        "Side01_04_BarcodeFound"         
## [483] "Side01_05_row1"                  "Side01_05_area"                 
## [485] "Side01_05_height"                "Side01_05_width"                
## [487] "Side01_05_circularity"           "Side01_05_compactness"          
## [489] "Side01_05_contlength"            "Side01_05_convexity"            
## [491] "Side01_05_rectangularity"        "Side01_05_anisometry"           
## [493] "Side01_05_bulkiness"             "Side01_05_struct_factor"        
## [495] "Side01_05_outer_radius"          "Side01_05_inner_radius"         
## [497] "Side01_05_dist_mean"             "Side01_05_dist_deviation"       
## [499] "Side01_05_roundness"             "Side01_05_holes_num"            
## [501] "Side01_05_areaInMm2"             "Side01_05_heightInMm"           
## [503] "Side01_05_widthInMm"             "Side01_05_Convex_Hull_Area"     
## [505] "Side01_05_AverageColor_H"        "Side01_05_AverageColor_S"       
## [507] "Side01_05_AverageColor_V"        "Side01_05_CenterOfMassX"        
## [509] "Side01_05_CenterOfMassY"         "Side01_05_CenterOfMassDistance" 
## [511] "Side01_05_H_Mean"                "Side01_05_H_Median"             
## [513] "Side01_05_H_StDev"               "Side01_05_H_Q1"                 
## [515] "Side01_05_H_Q3"                  "Side01_05_brown(H_14_27)"       
## [517] "Side01_05_brown-yellow(H_28_35)" "Side01_05_yellow(H_36_43)"      
## [519] "Side01_05_yellow-green(H_44_57)" "Side01_05_green(H_58_99)"       
## [521] "Side01_05_green-cyan(H_100_120)" "Side01_05_cyan-blue(H_121_142)" 
## [523] "Side01_05_blue(H_143_156)"       "Side01_05_HistoH_0_5"           
## [525] "Side01_05_HistoH_5_10"           "Side01_05_HistoH_10_15"         
## [527] "Side01_05_HistoH_15_20"          "Side01_05_HistoH_20_25"         
## [529] "Side01_05_HistoH_25_30"          "Side01_05_HistoH_30_35"         
## [531] "Side01_05_HistoH_35_40"          "Side01_05_HistoH_40_45"         
## [533] "Side01_05_HistoH_45_50"          "Side01_05_HistoH_50_55"         
## [535] "Side01_05_HistoH_55_60"          "Side01_05_HistoH_60_65"         
## [537] "Side01_05_HistoH_65_70"          "Side01_05_HistoH_70_75"         
## [539] "Side01_05_HistoH_75_80"          "Side01_05_HistoH_80_85"         
## [541] "Side01_05_HistoH_85_90"          "Side01_05_HistoH_90_95"         
## [543] "Side01_05_HistoH_95_100"         "Side01_05_HistoH_100_105"       
## [545] "Side01_05_HistoH_105_110"        "Side01_05_HistoH_110_115"       
## [547] "Side01_05_HistoH_115_120"        "Side01_05_HistoH_120_125"       
## [549] "Side01_05_HistoH_125_130"        "Side01_05_HistoH_130_135"       
## [551] "Side01_05_HistoH_135_140"        "Side01_05_HistoH_140_145"       
## [553] "Side01_05_HistoH_145_150"        "Side01_05_HistoH_150_155"       
## [555] "Side01_05_HistoH_155_160"        "Side01_05_HistoH_160_165"       
## [557] "Side01_05_HistoH_165_170"        "Side01_05_HistoH_170_175"       
## [559] "Side01_05_HistoH_175_180"        "Side01_05_HistoH_180_185"       
## [561] "Side01_05_HistoH_185_190"        "Side01_05_HistoH_190_195"       
## [563] "Side01_05_HistoH_195_200"        "Side01_05_HistoH_200_205"       
## [565] "Side01_05_HistoH_205_210"        "Side01_05_HistoH_210_215"       
## [567] "Side01_05_HistoH_215_220"        "Side01_05_HistoH_220_225"       
## [569] "Side01_05_HistoH_225_230"        "Side01_05_HistoH_230_235"       
## [571] "Side01_05_HistoH_235_240"        "Side01_05_HistoH_240_245"       
## [573] "Side01_05_HistoH_245_250"        "Side01_05_HistoH_250_255"       
## [575] "Side01_05_Greennes_Mean"         "Side01_05_Greennes_Deviation"   
## [577] "Side01_05_BarcodeEnabled"        "Side01_05_BarcodeFound"         
## [579] "row1"                            "area"                           
## [581] "height"                          "width"                          
## [583] "circularity"                     "compactness"                    
## [585] "contlength"                      "convexity"                      
## [587] "rectangularity"                  "anisometry"                     
## [589] "bulkiness"                       "struct_factor"                  
## [591] "outer_radius"                    "inner_radius"                   
## [593] "dist_mean"                       "dist_deviation"                 
## [595] "roundness"                       "holes_num"                      
## [597] "areaInMm2"                       "heightInMm"                     
## [599] "widthInMm"                       "Convex_Hull_Area"               
## [601] "AverageColor_H"                  "AverageColor_S"                 
## [603] "AverageColor_V"                  "CenterOfMassX"                  
## [605] "CenterOfMassY"                   "CenterOfMassDistance"           
## [607] "H_Mean"                          "H_Median"                       
## [609] "H_StDev"                         "H_Q1"                           
## [611] "H_Q3"                            "brown(H_14_27)"                 
## [613] "brown-yellow(H_28_35)"           "yellow(H_36_43)"                
## [615] "yellow-green(H_44_57)"           "green(H_58_99)"                 
## [617] "green-cyan(H_100_120)"           "cyan-blue(H_121_142)"           
## [619] "blue(H_143_156)"                 "HistoH_0_5"                     
## [621] "HistoH_5_10"                     "HistoH_10_15"                   
## [623] "HistoH_15_20"                    "HistoH_20_25"                   
## [625] "HistoH_25_30"                    "HistoH_30_35"                   
## [627] "HistoH_35_40"                    "HistoH_40_45"                   
## [629] "HistoH_45_50"                    "HistoH_50_55"                   
## [631] "HistoH_55_60"                    "HistoH_60_65"                   
## [633] "HistoH_65_70"                    "HistoH_70_75"                   
## [635] "HistoH_75_80"                    "HistoH_80_85"                   
## [637] "HistoH_85_90"                    "HistoH_90_95"                   
## [639] "HistoH_95_100"                   "HistoH_100_105"                 
## [641] "HistoH_105_110"                  "HistoH_110_115"                 
## [643] "HistoH_115_120"                  "HistoH_120_125"                 
## [645] "HistoH_125_130"                  "HistoH_130_135"                 
## [647] "HistoH_135_140"                  "HistoH_140_145"                 
## [649] "HistoH_145_150"                  "HistoH_150_155"                 
## [651] "HistoH_155_160"                  "HistoH_160_165"                 
## [653] "HistoH_165_170"                  "HistoH_170_175"                 
## [655] "HistoH_175_180"                  "HistoH_180_185"                 
## [657] "HistoH_185_190"                  "HistoH_190_195"                 
## [659] "HistoH_195_200"                  "HistoH_200_205"                 
## [661] "HistoH_205_210"                  "HistoH_210_215"                 
## [663] "HistoH_215_220"                  "HistoH_220_225"                 
## [665] "HistoH_225_230"                  "HistoH_230_235"                 
## [667] "HistoH_235_240"                  "HistoH_240_245"                 
## [669] "HistoH_245_250"                  "HistoH_250_255"                 
## [671] "Greennes_Mean"                   "Greennes_Deviation"             
## [673] "BarcodeEnabled"                  "BarcodeFound"
want <- c("Side01_00_area", "Side01_01_area", "Side01_02_area", "Side01_03_area", "Side01_04_area", "Side01_05_area", "area")
RGB_Area <- subset(RGB2, RGB2$measurement_name %in% want)
RGB_Area
RGB_Area <- RGB_Area[,c(1,4:6)]
RGB_Area
library(reshape2)
RGB_Area2 <- RGB_Area[,c(1:2,4,3)]
cRGB_Area <- dcast(RGB_Area2, timestamp + tray.ID ~ measurement_name)
## Using measurement_value as value column: use value.var to override.
cRGB_Area

not sure what all of the missing values are about - but lets remove them.

nona.RGB_Area <- na.omit(cRGB_Area)
nona.RGB_Area
unique(nona.RGB_Area$tray.ID)
## [1] 34913 34914 34915 34916 34917 34918

now let’s summarize the area from top view and 6 different angles into one value:

nona.RGB_Area$Area.all <- nona.RGB_Area$area + nona.RGB_Area$Side01_00_area + nona.RGB_Area$Side01_01_area + nona.RGB_Area$Side01_02_area + nona.RGB_Area$Side01_03_area + nona.RGB_Area$Side01_04_area + nona.RGB_Area$Side01_05_area
nona.RGB_Area

One last remaining thing would be to resolve the timestamp into the “Day of experiment”. First let’s split it into a date and time:

# date
strsplit(nona.RGB_Area$timestamp[1], "-")[[1]][1]
## [1] "20240614"
# time
strsplit(nona.RGB_Area$timestamp[1], "-")[[1]][2]
## [1] "110819"

now for all of the rows:

for(i in 1:nrow(nona.RGB_Area)){
  nona.RGB_Area$date[i] <-  strsplit(nona.RGB_Area$timestamp[i], "-")[[1]][1]
  nona.RGB_Area$time[i] <-  strsplit(nona.RGB_Area$timestamp[i], "-")[[1]][2]
}

nona.RGB_Area

plot the RGB data

library(ggplot2)
nona.RGB_Area$date <- as.factor(nona.RGB_Area$date)
unique(nona.RGB_Area$tray_id)
## NULL
#one_tray <- subset(nona.RGB_Area, nona.RGB_Area$tray_id == 40284)
lgraph <- ggplot(data=nona.RGB_Area, aes(x= date, y=Area.all, group = tray.ID)) 
lgraph <- lgraph + geom_line(alpha = 0.7) 
lgraph <- lgraph + ylab("digital biomass") + xlab("days after stress")
lgraph

OK - we see that there is something funky going on the 17th- probably there are two measurements that were taken. Let’s see if we can calculate it into hours of experiment.

What are the unique timestamps?

unique(nona.RGB_Area$timestamp)
##  [1] "20240614-110819" "20240614-110859" "20240614-110938" "20240614-111059"
##  [5] "20240614-111231" "20240614-111403" "20240615-181637" "20240615-182214"
##  [9] "20240615-182754" "20240615-183330" "20240615-183908" "20240615-184446"
## [13] "20240617-002314" "20240617-002853" "20240617-003431" "20240617-004009"
## [17] "20240617-004547" "20240617-005125" "20240617-104359" "20240617-104939"
## [21] "20240617-105519" "20240617-110059" "20240617-110639" "20240617-111219"
## [25] "20240618-104938" "20240618-105519" "20240618-110059" "20240618-110640"
## [29] "20240618-111220" "20240618-111801" "20240619-154332" "20240619-154912"
## [33] "20240619-155454" "20240619-160034" "20240619-160616" "20240619-161156"
## [37] "20240620-162024" "20240620-162606" "20240620-163147" "20240620-163729"
## [41] "20240620-164311" "20240620-164853"

Seems that the experiment started on 14th of June around 11 AM. Let’s use this as our time zero:

nona.RGB_Area$day <- substr(nona.RGB_Area$date, 7, 8)
nona.RGB_Area$hour <- substr(nona.RGB_Area$time, 1, 2)
nona.RGB_Area

now let’s calculate time of experiment in hours:

nona.RGB_Area$TOE <- (as.numeric(as.character(nona.RGB_Area$day)) - 14)*24 + (as.numeric(as.character(nona.RGB_Area$hour)) - 11)
nona.RGB_Area
lgraph <- ggplot(data=nona.RGB_Area, aes(x= TOE, y=Area.all, group = tray.ID)) 
lgraph <- lgraph + geom_line(alpha = 0.7) 
lgraph <- lgraph + ylab("digital biomass") + xlab("days after stress")
lgraph

now - let’s try to add more info - such as specific treatment from the decoding file:

nona.RGB_Area2 <- merge(nona.RGB_Area, decode, by = "tray.ID", all = T)
nona.RGB_Area2
library(ggpubr)
nona.RGB_Area2$Area.all <- as.numeric(as.character(nona.RGB_Area2$Area.all))
nona.RGB_Area2$TOE <- as.numeric(as.character(nona.RGB_Area2$TOE))
nona.RGB_Area2$TrayInfo <- as.factor(nona.RGB_Area2$TrayInfo)

Area_graph <- ggplot(data=nona.RGB_Area2, aes(x= TOE, y=Area.all, group = tray.ID, color = TrayInfo)) 
Area_graph <- Area_graph + geom_line(alpha = 0.7) 
#Area_graph <- Area_graph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group= TrayInfo), alpha=0.3)
Area_graph <- Area_graph + stat_summary(fun=mean, aes(group= TrayInfo),  size=0.7, geom="line", linetype = "dashed")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
#Area_graph <- Area_graph + stat_compare_means(aes(group = TrayInfo), label = "p.signif", method = "t.test", hide.ns = TRUE)
Area_graph <- Area_graph + ylab("Digital Biomass") + xlab("Time of imaging (h)")
Area_graph

The reason we have these odd lines - is that some of the trays got imaged one hour later - which pulls average into totally different direction (aka - one sample average). In order to make sure that we are comparing like-with-like - we can implement splines - so we can “predict” the values for all timepoints - however - we need to make sure that we are not over-interpreting the data - as in - predicting on a time scale of minutes or hours - as we have imaged approximately every 24h.

So - how do we do it? Splines - sounds complicated. But it is not. First - let’s take one tray and calculate predicted spline values based on one tray:

# Create a vector 'hours' containing values from 0 to 144 (6 days of imaging)
days <- seq(0, 144, by = 24)
days
## [1]   0  24  48  72  96 120 144
# Subset the data for one tray 
temp <- subset(nona.RGB_Area2, nona.RGB_Area2$tray.ID == unique(nona.RGB_Area2$tray.ID)[1])

# Convert the 'TOE' column in 'temp' from a factor to numeric
temp$TOE <- as.numeric(as.character(temp$TOE))

# Display the 'days' column from the 'temp' data frame
temp$TOE
## [1]   0  71  31  95 124 149  61
# Fit a cubic smoothing spline to the 'TOE' and 'Area.all' data in the 'temp' data frame
plot.spl <- with(temp, smooth.spline(TOE, Area.all, df = 5))
# Create a scatterplot of 'Area.sum' against 'days' using data from 'temp'
plot(Area.all ~ TOE, data = temp)

# Add a blue line to the plot based on the cubic smoothing spline ('plot.spl')
lines(plot.spl, col = "blue")

# Add a red line to the plot by predicting values using the cubic smoothing spline ('plot.spl')
lines(predict(plot.spl, days), col = "red")

# Define a vector 'names' containing column names
names <- c(text = "tray.ID", "TrayInfo", "TOE", "Area.SUM")

# Create an empty data frame 'spline_data' to store the data
spline_data <- data.frame()

# Loop through each element 'k' in the 'names' vector
for (k in names) {
  # Create a new column in 'spline_data' with the name specified by 'k' and initialize it as character type
  spline_data[[k]] <- as.character()
}

spline_data
pred_temp <- predict(plot.spl, days)

# Display the predictions stored in 'pred_temp'
pred_temp
## $x
## [1]   0  24  48  72  96 120 144
## 
## $y
## [1]  742347.8  775630.5  836667.0  885372.5  947793.0 1044476.1 1145080.1
# Update the first 7 rows of the 'spline_data' data frame, setting the 4th column to 'pred_temp$x'
spline_data[1:7, 3] <- pred_temp$x

# Update the first 7 rows of the 'spline_data' data frame, setting the 5th column to 'pred_temp$y'
spline_data[1:7, 4] <- pred_temp$y

# Update the first 7 rows of the 'spline_data' data frame, setting the 1st column to 'temp$TrayID[1]'
spline_data[1:7, 1] <- temp$tray.ID[1]

# Update the first 7 rows of the 'spline_data' data frame, setting the 2nd column to 'temp$TrayInfo[1]'
spline_data[1:7, 2] <- as.character(temp$TrayInfo[1])

spline_data
# Create a copy of 'spline_data' and store it in 'final_spline'
final_spline <- spline_data
# check how many unique plant IDs we have 
all_plants <- unique(nona.RGB_Area2$tray.ID)
length(all_plants)
## [1] 6

now let’s do it for all plants:

for (i in 2:6) {
  temp <- subset(nona.RGB_Area2, nona.RGB_Area2$tray.ID == unique(nona.RGB_Area2$tray.ID)[i])

  # Check if 'temp' has more than 4 rows
  if (dim(temp)[1] > 4) {
    # Fit a cubic smoothing spline to 'days' and 'Area.sum' in 'temp'
    plot.spl <- with(temp, smooth.spline(TOE, Area.all, df = 5))

    # Generate predictions using the smoothing spline
    pred_temp <- predict(plot.spl, days)

    # Update specific columns in 'spline_data' with 'pred_temp' and 'temp' values
    spline_data[1:7, 3] <- pred_temp$x
    spline_data[1:7, 4] <- pred_temp$y
    spline_data[1:7, 1] <- temp$tray.ID[1]
    spline_data[1:7, 2] <- as.character(temp$TrayInfo[1])

    # Append 'spline_data' to 'final_spline'
    final_spline <- rbind(final_spline, spline_data)
  } else {
    # Set specific columns in 'spline_data' when 'temp' has <= 4 rows
    spline_data[1:7, 3] <- days
    spline_data[1:7, 4] <- 0
    spline_data[1:7, 1] <- temp$tray.ID[1]
    spline_data[1:7, 2] <- as.character(temp$TrayInfo[1])
  }
}

final_spline
# Convert the 'TOE' column in 'final_spline' to numeric type
final_spline$TOE <- as.numeric(as.character(final_spline$TOE))

# Convert the 'Area.SUM' column in 'final_spline' to numeric type
final_spline$Area.SUM <- as.numeric(as.character(final_spline$Area.SUM))

# Filter 'final_spline' to keep rows where 'Area.SUM' is greater than 1
final_spline <- final_spline[final_spline$Area.SUM > 1, ]

final_spline
library(ggsci)

# Convert 'Area.SUM' column to numeric type
final_spline$Area.SUM <- as.numeric(as.character(final_spline$Area.SUM))

# Convert 'day' column to a factor with numeric levels
final_spline$TOE <- as.factor(as.numeric(as.character(final_spline$TOE)))

# Create a line graph (Area_lgraph) using ggplot2
Area_lgraph <- ggplot(data = final_spline, aes(x = TOE, y = Area.SUM, group = tray.ID, color = TrayInfo)) 
Area_lgraph <- Area_lgraph + geom_line(alpha = 0.1)
Area_lgraph <- Area_lgraph + stat_summary(fun.data = mean_se, geom = "ribbon", linetype = 0, aes(group = TrayInfo), alpha = 0.3) 
Area_lgraph <- Area_lgraph + stat_summary(fun = mean, aes(group = TrayInfo), size = 0.7, geom = "line", linetype = "dashed") 
Area_lgraph <- Area_lgraph + stat_compare_means(aes(group = TrayInfo), label = "p.signif", method = "t.test", hide.ns = F) 
Area_lgraph <- Area_lgraph + labs(x = "Hours of Imaging", y = "Digital Biomass (a.u.)") + scale_color_d3("category10") + theme(legend.position = "bottom")
Area_lgraph

Calculating growth rates for each plant:

Now that we have the clean data - let’s calculate the growth rates throughout the experiment:

First let’s isolate one plant from the experiment

temp <- subset(final_spline, final_spline$tray.ID == unique(final_spline$tray.ID)[1])
temp

let’s plot the change in plant size

temp$Area.SUM <- as.numeric(temp$Area.SUM)
temp$TOE <- as.numeric(as.character(temp$TOE))
plot(temp$Area.SUM ~ temp$TOE)

let’s add a linear regression model to this graph:

plot(temp$Area.SUM ~ temp$TOE) + abline(lm(temp$Area.SUM ~ temp$TOE))

## integer(0)

awesome - now let’s extract the aspects of the linear regression into a table:

summary(lm(temp$Area.SUM ~ temp$TOE))
## 
## Call:
## lm(formula = temp$Area.SUM ~ temp$TOE)
## 
## Residuals:
##        1        2        3        4        5        6        7 
##  30261.2  -2778.1  -8063.5 -25679.9 -29581.4    779.8  35061.9 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 712086.6    18667.8   38.15 2.33e-07 ***
## temp$TOE      2763.4      215.7   12.81 5.16e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27400 on 5 degrees of freedom
## Multiple R-squared:  0.9704, Adjusted R-squared:  0.9645 
## F-statistic: 164.1 on 1 and 5 DF,  p-value: 5.16e-05
model <- lm(temp$Area.SUM ~ temp$TOE)
model
## 
## Call:
## lm(formula = temp$Area.SUM ~ temp$TOE)
## 
## Coefficients:
## (Intercept)     temp$TOE  
##      712087         2763

from that model - I need to extract temp$TOE - as this is the “growth rate” with which my plants are growing (pixels / day). Which I get to by following command:

model$coefficients[[2]]
## [1] 2763.414

I would also like to save how well my model fits the observed data (R square):

summary(model)$adj.r.squared
## [1] 0.9645151

Now let’s make a table and save all of this data in the table:

names <- c(text = "tray.ID", "TrayInfo", "GR", "Adj.Rsq")

# Create an empty data frame 'spline_data' to store the data
growth_data <- data.frame()

# Loop through each element 'k' in the 'names' vector
for (k in names) {
  # Create a new column in 'spline_data' with the name specified by 'k' and initialize it as character type
  growth_data[[k]] <- as.character()
}

growth_data[1,1] <- temp$tray.ID[1]
growth_data[1,2] <- temp$TrayInfo[1]
growth_data[1,3] <- model$coefficients[[2]]
growth_data[1,4] <- summary(model)$adj.r.squared
growth_data

Great - now we can loop it for all unique plants in our dataset:

for(i in 2:length(unique(final_spline$tray.ID))){
  temp <- subset(final_spline, final_spline$tray.ID == unique(final_spline$tray.ID)[i])
  temp$Area.SUM <- as.numeric(temp$Area.SUM)
  temp$TOE <- as.numeric(as.character(temp$TOE))
  model <- lm(temp$Area.SUM ~ temp$TOE)
  growth_data[i,1] <- temp$tray.ID[1]
  growth_data[i,2] <- temp$TrayInfo[1]
  growth_data[i,3] <- model$coefficients[[2]]
  growth_data[i,4] <- summary(model)$adj.r.squared
}

growth_data

Awesome - now let;s plot this:

growth_data$GR <- as.numeric(as.character(growth_data$GR))

GR_overall <- ggerrorplot(growth_data, x = "TrayInfo", y = "GR", color = "TrayInfo", fill = "TrayInfo",
                          desc_stat = "mean_sd", add = "jitter", ncol = 8,
                          xlab="", ylab= "Growth Rate (pixel / hour)", add.params = list(color = "darkgray")) 
GR_overall <- GR_overall + stat_compare_means(aes(label = after_stat(p.signif)), method = "aov", hide.ns = T)
GR_overall <- GR_overall + rremove("legend")
GR_overall

OK - that looks great - now let’s move onto PS2 data:

PS2 data loading

PS2 <- read.csv("Annie_VIGS_Suvita_20240621.csv")
PS2

remove “all” from my Object number analyzed results:

PS3 <- subset(PS2, PS2$Obj.No != "All")
PS3

get only the columns that are informative biologically (for now):

colnames(PS3)
##   [1] "File"           "Date"           "Time"           "Obj.No"        
##   [5] "nTmPam"         "Obj.Size"       "Obj.Xc"         "Obj.Yc"        
##   [9] "dFv.Fm"         "s.e."           "F0"             "s.e..1"        
##  [13] "Fj"             "s.e..2"         "Fi"             "s.e..3"        
##  [17] "Fm"             "s.e..4"         "X1.Fj.Fm"       "s.e..5"        
##  [21] "X1.Fi.Fm"       "s.e..6"         "Fv.Fm"          "s.e..7"        
##  [25] "IC.Area"        "s.e..8"         "IC.Area.Fv"     "s.e..9"        
##  [29] "PI"             "s.e..10"        "dFq.Fm"         "s.e..11"       
##  [33] "Fs."            "s.e..12"        "Fm."            "s.e..13"       
##  [37] "Fq..Fm."        "s.e..14"        "rETR"           "s.e..15"       
##  [41] "dRfd"           "s.e..16"        "RfdFm"          "s.e..17"       
##  [45] "RfdFt"          "s.e..18"        "Rfd"            "s.e..19"       
##  [49] "Rfd.I..px."     "Rfd.I...."      "Rfd.II..px."    "Rfd.II...."    
##  [53] "Rfd.III..px."   "Rfd.III...."    "Rfd.IV..px."    "Rfd.IV...."    
##  [57] "Rfd.V..px."     "Rfd.V...."      "NPQ"            "s.e..20"       
##  [61] "F0."            "s.e..21"        "qP"             "s.e..22"       
##  [65] "qN"             "s.e..23"        "qL"             "s.e..24"       
##  [69] "qE"             "s.e..25"        "qI"             "s.e..26"       
##  [73] "X.Ñno"          "s.e..27"        "X.Ñnpq"         "s.e..28"       
##  [77] "npq.t."         "s.e..29"        "Red"            "s.e..30"       
##  [81] "Green"          "s.e..31"        "Blue"           "s.e..32"       
##  [85] "Hue"            "s.e..33"        "Saturation"     "s.e..34"       
##  [89] "Value"          "s.e..35"        "SpcGrn"         "s.e..36"       
##  [93] "FarRed"         "s.e..37"        "Nir"            "s.e..38"       
##  [97] "ChlIdx"         "s.e..39"        "AriIdx"         "s.e..40"       
## [101] "NDVI"           "s.e..41"        "dGfp"           "s.e..42"       
## [105] "Gfp"            "s.e..43"        "Auto"           "s.e..44"       
## [109] "cGfp"           "s.e..45"        "MaskGfp"        "nObjGfp"       
## [113] "nObjSize"       "s.e..46"        "Gfp.I..px."     "Gfp.I...."     
## [117] "Gfp.II..px."    "Gfp.II...."     "Gfp.III..px."   "Gfp.III...."   
## [121] "Gfp.IV..px."    "Gfp.IV...."     "Gfp.V..px."     "Gfp.V...."     
## [125] "dRfp"           "s.e..47"        "Rfp"            "s.e..48"       
## [129] "MaskRfp"        "nObjRfp"        "nObjSize.1"     "s.e..49"       
## [133] "Rfp.I..px."     "Rfp.I...."      "Rfp.II..px."    "Rfp.II...."    
## [137] "Rfp.III..px."   "Rfp.III...."    "Rfp.IV..px."    "Rfp.IV...."    
## [141] "Rfp.V..px."     "Rfp.V...."      "dChl"           "s.e..50"       
## [145] "Chl"            "s.e..51"        "aRed"           "s.e..52"       
## [149] "aFarRed"        "s.e..53"        "Alpha"          "s.e..54"       
## [153] "Border"         "Mask.Border"    "Points"         "Area..CH."     
## [157] "Mask.Area..CH." "X.Centre"       "Y.Centre"       "Radius"        
## [161] "Area..MC."      "Mask.Area..MC." "Size..SK."      "Junction..SK." 
## [165] "Endpoint..SK."  "Path..SK."
PS4 <- PS3[,c(1:3,23, 37, 59,77,97,99, 101)]
PS4
PS4$Date <- as.factor(PS4$Date)
lgraph <- ggplot(data=PS4, aes(x= Date, y=ChlIdx)) 
lgraph <- lgraph + geom_point(alpha = 0.7) 
lgraph <- lgraph + ylab("Chlorophylll Index") + xlab("days after stress")
lgraph

This is great start, but lets isolate the measurement per tray ID - which is the third item in the File name (HDR_ExpID_TrayID_roundID.INF)

How do we get there?

strsplit(PS4$File[1], "_")[[1]][3]
## [1] "34913"

Now - lets isolate it for the entire data sheet:

for(i in 1:nrow(PS4)){
  PS4$tray.ID[i] <- strsplit(PS4$File[i], "_")[[1]][3]
}

PS4
lgraph <- ggplot(data=PS4, aes(x= Date, y=ChlIdx, group = tray.ID)) 
lgraph <- lgraph + geom_line(alpha = 0.7) 
lgraph <- lgraph + ylab("Chlorophylll Index") + xlab("days after stress")
lgraph

the straight lines at the date are signifying that there are more than one measurement taken per day - so we maybe plot it per round ID instead. But first we need to isolate it from File name again o_O’

gsub(".INF", "", strsplit(PS4$File[1], "_")[[1]][4])
## [1] "10"

Now - lets isolate it for the entire data sheet:

for(i in 1:nrow(PS4)){
  PS4$Round.ID[i] <- gsub(".INF", "", strsplit(PS4$File[i], "_")[[1]][4])
}

PS4

Let;s try to replot it:

lgraph <- ggplot(data=PS4, aes(x= Round.ID, y=ChlIdx, group = tray.ID)) 
lgraph <- lgraph + geom_line(alpha = 0.7) 
lgraph <- lgraph + ylab("Chlorophylll Index") + xlab("rounds of imaging")
lgraph

Now - let’s try to figure out what are our treatments

What are our TrayIDs again here:

unique(PS4$tray.ID)
## [1] "34913" "34914" "34915" "34916" "34917" "34918"

Lets upload decoding file:

decode <- read.csv("20240614_Annie_VIGS_1x1.xlsx - Sheet1.csv")
decode <- decode[,c(2:3,6,7)]
decode
colnames(PS4)
##  [1] "File"     "Date"     "Time"     "Fv.Fm"    "Fq..Fm."  "NPQ"     
##  [7] "npq.t."   "ChlIdx"   "AriIdx"   "NDVI"     "tray.ID"  "Round.ID"
colnames(decode)
## [1] "Tray.ID"   "TrayInfo"  "PlantID"   "PlantName"
colnames(decode)[1] <- "tray.ID"
colnames(decode)
## [1] "tray.ID"   "TrayInfo"  "PlantID"   "PlantName"
PS4deco <- merge(PS4, decode, by = "tray.ID", all = T)
PS4deco
lgraph <- ggplot(data=PS4deco, aes(x= Round.ID, y=ChlIdx, group = tray.ID, color = TrayInfo)) 
lgraph <- lgraph + geom_line(alpha = 0.7) 
lgraph <- lgraph + ylab("Chlorophylll Index") + xlab("rounds of imaging")
lgraph

Wait - but this round numbering does not make sense!!!! Let’s change it to something that does.. Maybe numeric?

PS4deco$Round.ID <- as.numeric(PS4deco$Round.ID)

lgraph <- ggplot(data=PS4deco, aes(x= Round.ID, y=ChlIdx, group = tray.ID, color = TrayInfo)) 
lgraph <- lgraph + geom_line(alpha = 0.7) 
lgraph <- lgraph + ylab("Chlorophylll Index") + xlab("rounds of imaging")
lgraph

This is all good - but let’s layer some more stats info onto this - like average trend line +/- SE;

library(ggpubr)

ChlIndex_graph <- ggplot(data=PS4deco, aes(x= Round.ID, y=ChlIdx, group = tray.ID, color = TrayInfo)) 
ChlIndex_graph <- ChlIndex_graph + geom_line(alpha = 0.7) 
ChlIndex_graph <- ChlIndex_graph + stat_summary(fun.data = mean_se, geom="ribbon", linetype=0, aes(group= TrayInfo), alpha=0.3)
ChlIndex_graph <- ChlIndex_graph + stat_summary(fun=mean, aes(group= TrayInfo),  size=0.7, geom="line", linetype = "dashed")
ChlIndex_graph <- ChlIndex_graph + stat_compare_means(aes(group = TrayInfo), label = "p.signif", method = "t.test", hide.ns = TRUE)
ChlIndex_graph <- ChlIndex_graph + ylab("Chlorophylll Index") + xlab("rounds of imaging")
ChlIndex_graph