Rbin-file used for this script: ~/Data/CoordSys_FLT1-7_50x.Rbin


1. Goal of the script

The script will plot all ISO 25178 variables to see which ones should be used for further analysis.
It will also plot the X/Y shift for each microscope.

Scatterplot of each variable will be plotted.
All plots will be saved in a subfolder “Plots” within the directory of the present Rmd file, i.e. “~/Plots”.


2. Load packages

library(R.utils)
library(ggplot2)
library(tools)

3. Load data into R object

imp.info <- file.info(params$data)
imp.data <- loadObject(params$data)

The imported file is: “~/Data/CoordSys_FLT1-7_50x.Rbin”
Its modification, ‘last status change’ (= ‘creation’ on Windows) and last access times are, respectively: “2019-01-03 10:28:47”, “2019-01-03 10:28:47” and “2019-01-03 10:28:47”.


4. Define numeric variables

num.var.topo <- 19:47
num.var.shift <- 54:55
names(imp.data)[num.var.topo]
 [1] "Sq"   "Ssk"  "Sku"  "Sp"   "Sv"   "Sz"   "Sa"   "Smr"  "Smc"  "Sxp" 
[11] "Sal"  "Str"  "Std"  "Sdq"  "Sdr"  "Vm"   "Vv"   "Vmp"  "Vmc"  "Vvc" 
[21] "Vvv"  "Sk"   "Spk"  "Svk"  "Smr1" "Smr2" "Spq"  "Svq"  "Smq" 
names(imp.data)[num.var.shift]
[1] "Xshift" "Yshift"

5. Plot each of the selected numeric variable

5.1. ISO parameters

for (i in num.var.topo){
    file.out <- paste0(basename(file_path_sans_ext(row.names(imp.info))), "_plot_", names(imp.data)[i], ".pdf")
    p <- ggplot(data=imp.data, aes_string(x="Microscope", y=names(imp.data)[i], color="Microscope", shape="Microscope")) + geom_boxplot(outlier.shape=8) + geom_jitter(size=3, position=position_jitterdodge(jitter.width=0.7, dodge.width=0.7)) + theme_classic()
    print(p)
    ggsave(filename=file.out, path=dir.plots, device="pdf")
}

Warning: Removed 10 rows containing non-finite values (stat_boxplot).
Warning: Removed 10 rows containing missing values (geom_point).
Warning: Removed 10 rows containing non-finite values (stat_boxplot).
Warning: Removed 10 rows containing missing values (geom_point).

Warning: Removed 10 rows containing non-finite values (stat_boxplot).

Warning: Removed 10 rows containing missing values (geom_point).
Warning: Removed 10 rows containing non-finite values (stat_boxplot).
Warning: Removed 10 rows containing missing values (geom_point).

Warning: Removed 10 rows containing non-finite values (stat_boxplot).

Warning: Removed 10 rows containing missing values (geom_point).
Warning: Removed 10 rows containing non-finite values (stat_boxplot).
Warning: Removed 10 rows containing missing values (geom_point).

5.2. X/Y shifts

for (i in num.var.shift){
    file.out <- paste0(basename(file_path_sans_ext(row.names(imp.info))), "_plot_", names(imp.data)[i], ".pdf")
    p <- ggplot(data=imp.data[-c(1,11),], aes_string(x="Microscope", y=names(imp.data)[i], color="Microscope", shape="Microscope")) + geom_boxplot(outlier.shape=8) + geom_point(size=3, position=position_jitterdodge(jitter.width=0.7, dodge.width=0.7)) + ylim(0,130) + theme_classic()
    print(p)
    ggsave(filename=file.out, path=dir.plots, device="pdf")
}

5.3. Summary

The following plot(s) was (were) created in and saved in “~/Plots”:

 [1] "CoordSys_FLT1-7_50x_plot_Sa.pdf"    
 [2] "CoordSys_FLT1-7_50x_plot_Sal.pdf"   
 [3] "CoordSys_FLT1-7_50x_plot_Sdq.pdf"   
 [4] "CoordSys_FLT1-7_50x_plot_Sdr.pdf"   
 [5] "CoordSys_FLT1-7_50x_plot_Sk.pdf"    
 [6] "CoordSys_FLT1-7_50x_plot_Sku.pdf"   
 [7] "CoordSys_FLT1-7_50x_plot_Smc.pdf"   
 [8] "CoordSys_FLT1-7_50x_plot_Smq.pdf"   
 [9] "CoordSys_FLT1-7_50x_plot_Smr.pdf"   
[10] "CoordSys_FLT1-7_50x_plot_Smr1.pdf"  
[11] "CoordSys_FLT1-7_50x_plot_Smr2.pdf"  
[12] "CoordSys_FLT1-7_50x_plot_Sp.pdf"    
[13] "CoordSys_FLT1-7_50x_plot_Spk.pdf"   
[14] "CoordSys_FLT1-7_50x_plot_Spq.pdf"   
[15] "CoordSys_FLT1-7_50x_plot_Sq.pdf"    
[16] "CoordSys_FLT1-7_50x_plot_Ssk.pdf"   
[17] "CoordSys_FLT1-7_50x_plot_Std.pdf"   
[18] "CoordSys_FLT1-7_50x_plot_Str.pdf"   
[19] "CoordSys_FLT1-7_50x_plot_Sv.pdf"    
[20] "CoordSys_FLT1-7_50x_plot_Svk.pdf"   
[21] "CoordSys_FLT1-7_50x_plot_Svq.pdf"   
[22] "CoordSys_FLT1-7_50x_plot_Sxp.pdf"   
[23] "CoordSys_FLT1-7_50x_plot_Sz.pdf"    
[24] "CoordSys_FLT1-7_50x_plot_Vm.pdf"    
[25] "CoordSys_FLT1-7_50x_plot_Vmc.pdf"   
[26] "CoordSys_FLT1-7_50x_plot_Vmp.pdf"   
[27] "CoordSys_FLT1-7_50x_plot_Vv.pdf"    
[28] "CoordSys_FLT1-7_50x_plot_Vvc.pdf"   
[29] "CoordSys_FLT1-7_50x_plot_Vvv.pdf"   
[30] "CoordSys_FLT1-7_50x_plot_Xshift.pdf"
[31] "CoordSys_FLT1-7_50x_plot_Yshift.pdf"

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] ggplot2_3.1.0     R.utils_2.7.0     R.oo_1.22.0       R.methodsS3_1.7.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0       bindr_0.1.1      knitr_1.21       magrittr_1.5    
 [5] tidyselect_0.2.5 munsell_0.5.0    colorspace_1.3-2 R6_2.3.0        
 [9] rlang_0.3.0.1    dplyr_0.7.8      stringr_1.3.1    plyr_1.8.4      
[13] grid_3.5.2       gtable_0.2.0     xfun_0.4         withr_2.1.2     
[17] htmltools_0.3.6  assertthat_0.2.0 yaml_2.2.0       lazyeval_0.2.1  
[21] digest_0.6.18    tibble_1.4.2     crayon_1.3.4     bindrcpp_0.2.2  
[25] purrr_0.2.5      glue_1.3.0       evaluate_0.12    rmarkdown_1.11  
[29] labeling_0.3     stringi_1.2.4    compiler_3.5.2   pillar_1.3.1    
[33] scales_1.0.0     pkgconfig_2.0.2 

END OF SCRIPT