this is the duf-5 soil salt phenotyping experiment. 1 week on control plate, 1 week on soil at 100% WHC, and then a two weeks old seedlings or three weeks old seedlings were treated with 200 mM salt. the water holding capacity were at 50% throughout experiment. weight loss in water compensated with water only. and then at week 5 samples collected for ICP-MS of rosette leaves.

getwd()
## [1] "C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20211212_duf-5_soil_grown_DW"
setwd("C:/Users/Julkowska Lab/Desktop/R codes by Maryam/20211212_duf-5_soil_grown_DW")
list.files(pattern = ".csv")
## [1] "20211212_duf-5_soil_grown_DW.csv"                
## [2] "Eric01072022NaK - analyzed -ICP_analysis_inR.csv"
## [3] "Eric01072022NaK - analyzed -ICPinR.csv"
duf_soil_ICP<-read.csv("Eric01072022NaK - analyzed -ICP_analysis_inR.csv")
duf_soil_ICP
ABCDEFGHIJ0123456789
ï..All.ID
<chr>
Genotype
<chr>
Condition
<chr>
K.con..mg.mg.dry.weight
<dbl>
Na.con.mg.mg.dry.weight
<dbl>
Na.K.ratio
<dbl>
ctrl-colcolcontrol37.441991.48091900.03955236
ctrl-colcolcontrol27.860731.85980700.06675371
ctrl-colcolcontrol35.962581.37526530.03824156
ctrl-colcolcontrol29.755841.36491720.04587056
ctrl-colcolcontrol30.397391.40770440.04631004
ctrl-colcolcontrol37.865591.47116680.03885234
ctrl-colcolcontrol40.446782.00455740.04956037
ctrl-colcolcontrol29.674051.12167380.03779983
ctrl-dufdufcontrol34.800531.32171030.03797960
ctrl-dufdufcontrol36.670051.91619260.05225497
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.0.5
library(multcompView)
## Warning: package 'multcompView' was built under R version 4.0.5
library(cowplot)
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:ggpubr':
## 
##     get_legend
colnames(duf_soil_ICP)
## [1] "ï..All.ID"               "Genotype"               
## [3] "Condition"               "K.con..mg.mg.dry.weight"
## [5] "Na.con.mg.mg.dry.weight" "Na.K.ratio"
duf_soil_ICP$GenoCon <- paste(duf_soil_ICP$Condition,  duf_soil_ICP$Genotype, sep="_")
duf_soil_ICP
ABCDEFGHIJ0123456789
ï..All.ID
<chr>
Genotype
<chr>
Condition
<chr>
K.con..mg.mg.dry.weight
<dbl>
Na.con.mg.mg.dry.weight
<dbl>
Na.K.ratio
<dbl>
ctrl-colcolcontrol37.441991.48091900.03955236
ctrl-colcolcontrol27.860731.85980700.06675371
ctrl-colcolcontrol35.962581.37526530.03824156
ctrl-colcolcontrol29.755841.36491720.04587056
ctrl-colcolcontrol30.397391.40770440.04631004
ctrl-colcolcontrol37.865591.47116680.03885234
ctrl-colcolcontrol40.446782.00455740.04956037
ctrl-colcolcontrol29.674051.12167380.03779983
ctrl-dufdufcontrol34.800531.32171030.03797960
ctrl-dufdufcontrol36.670051.91619260.05225497
aov(Na.con.mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP)
## Call:
##    aov(formula = Na.con.mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP)
## 
## Terms:
##                  GenoCon Residuals
## Sum of Squares  998.7591   57.6581
## Deg. of Freedom        5        43
## 
## Residual standard error: 1.157966
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Na.con.mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Na.con.mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP)
## 
## $GenoCon
##                                     diff       lwr        upr     p adj
## control_duf-control_col     -0.007654763 -1.645589  1.6302796 1.0000000
## EarlySalt_col-control_col   11.882404854 10.155870 13.6089392 0.0000000
## EarlySalt_duf-control_col    9.827229458  8.040097 11.6143623 0.0000000
## LateSalt_col-control_col     5.875706656  4.149172  7.6022410 0.0000000
## LateSalt_duf-control_col     5.444734376  3.718200  7.1712688 0.0000000
## EarlySalt_col-control_duf   11.890059617 10.252125 13.5279939 0.0000000
## EarlySalt_duf-control_duf    9.834884222  8.133193 11.5365751 0.0000000
## LateSalt_col-control_duf     5.883361419  4.245427  7.5212957 0.0000000
## LateSalt_duf-control_duf     5.452389139  3.814455  7.0903235 0.0000000
## EarlySalt_duf-EarlySalt_col -2.055175395 -3.842308 -0.2680425 0.0158823
## LateSalt_col-EarlySalt_col  -6.006698198 -7.733233 -4.2801638 0.0000000
## LateSalt_duf-EarlySalt_col  -6.437670477 -8.164205 -4.7111361 0.0000000
## LateSalt_col-EarlySalt_duf  -3.951522803 -5.738656 -2.1643899 0.0000007
## LateSalt_duf-EarlySalt_duf  -4.382495082 -6.169628 -2.5953622 0.0000001
## LateSalt_duf-LateSalt_col   -0.430972279 -2.157507  1.2955621 0.9750575
P5 = Output$GenoCon[,'p adj']
stat.test<- multcompLetters(P5)
stat.test
##   control_duf EarlySalt_col EarlySalt_duf  LateSalt_col  LateSalt_duf 
##           "a"           "b"           "c"           "d"           "d" 
##   control_col 
##           "a"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
ABCDEFGHIJ0123456789
 
 
Tukey
<chr>
group1
<chr>
group2
<chr>
control_dufacontrol_dufcontrol_duf
EarlySalt_colbEarlySalt_colEarlySalt_col
EarlySalt_dufcEarlySalt_dufEarlySalt_duf
LateSalt_coldLateSalt_colLateSalt_col
LateSalt_dufdLateSalt_dufLateSalt_duf
control_colacontrol_colcontrol_col
Na_content <- ggplot(data = duf_soil_ICP, mapping = aes(x = GenoCon, y = Na.con.mg.mg.dry.weight, colour = Condition)) 
Na_content <- Na_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Na_content <- Na_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")

Na_content <- Na_content + ylab("Na content, mg/mg dry weight") + xlab("")
Na_content <- Na_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Na_content <- Na_content + stat_pvalue_manual(test, label = "Tukey", y.position = 20)
Na_content

#I have to facet grid condition, 
Na_content <- ggplot(data = duf_soil_ICP, mapping = aes(x = Genotype, y = Na.con.mg.mg.dry.weight, colour = Genotype)) 
Na_content <- Na_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

Na_content <- Na_content + facet_grid(~ Condition)

Na_content <- Na_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
Na_content <- Na_content +scale_color_manual(values = c("mediumblue", "deeppink2"))
Na_content <- Na_content + ylab("Na content, mg/mg dry weight") + xlab("")
Na_content <- Na_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
Na_content <- Na_content + rremove("legend")
Na_content

aov(K.con..mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP)
## Call:
##    aov(formula = K.con..mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP)
## 
## Terms:
##                  GenoCon Residuals
## Sum of Squares  173.2122  768.6251
## Deg. of Freedom        5        43
## 
## Residual standard error: 4.227884
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(K.con..mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = K.con..mg.mg.dry.weight ~ GenoCon, data = duf_soil_ICP)
## 
## $GenoCon
##                                   diff        lwr      upr     p adj
## control_duf-control_col     -1.4995083  -7.479817 4.480800 0.9745653
## EarlySalt_col-control_col   -0.1163763  -6.420175 6.187422 0.9999999
## EarlySalt_duf-control_col   -3.5343036 -10.059355 2.990748 0.5933195
## LateSalt_col-control_col    -4.3313719 -10.635170 1.972426 0.3328046
## LateSalt_duf-control_col    -4.6094263 -10.913225 1.694372 0.2677776
## EarlySalt_col-control_duf    1.3831319  -4.597176 7.363440 0.9821652
## EarlySalt_duf-control_duf   -2.0347954  -8.247887 4.178296 0.9228713
## LateSalt_col-control_duf    -2.8318636  -8.812172 3.148445 0.7196251
## LateSalt_duf-control_duf    -3.1099180  -9.090226 2.870390 0.6342807
## EarlySalt_duf-EarlySalt_col -3.4179273  -9.942979 3.107124 0.6271345
## LateSalt_col-EarlySalt_col  -4.2149956 -10.518794 2.088803 0.3624800
## LateSalt_duf-EarlySalt_col  -4.4930500 -10.796848 1.810748 0.2939455
## LateSalt_col-EarlySalt_duf  -0.7970683  -7.322119 5.727983 0.9990993
## LateSalt_duf-EarlySalt_duf  -1.0751227  -7.600174 5.449929 0.9962358
## LateSalt_duf-LateSalt_col   -0.2780544  -6.581853 6.025744 0.9999941
P4 = Output$GenoCon[,'p adj']
stat.test<- multcompLetters(P4)
stat.test
## $Letters
##   control_duf EarlySalt_col EarlySalt_duf  LateSalt_col  LateSalt_duf 
##           "a"           "a"           "a"           "a"           "a" 
##   control_col 
##           "a" 
## 
## $LetterMatrix
##                  a
## control_duf   TRUE
## EarlySalt_col TRUE
## EarlySalt_duf TRUE
## LateSalt_col  TRUE
## LateSalt_duf  TRUE
## control_col   TRUE
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
ABCDEFGHIJ0123456789
 
 
Tukey
<chr>
group1
<chr>
group2
<chr>
control_dufacontrol_dufcontrol_duf
EarlySalt_colaEarlySalt_colEarlySalt_col
EarlySalt_dufaEarlySalt_dufEarlySalt_duf
LateSalt_colaLateSalt_colLateSalt_col
LateSalt_dufaLateSalt_dufLateSalt_duf
control_colacontrol_colcontrol_col
K_content <- ggplot(data = duf_soil_ICP, mapping = aes(x = GenoCon, y = K.con..mg.mg.dry.weight, colour = Condition)) 
K_content <- K_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

K_content <- K_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")

K_content <- K_content + ylab("K content, mg/mg dry weight") + xlab("")
K_content <- K_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
K_content <- K_content + stat_pvalue_manual(test, label = "Tukey", y.position = 50)
K_content

k_content <- ggplot(data = duf_soil_ICP, mapping = aes(x = Genotype, y = K.con..mg.mg.dry.weight, colour = Genotype)) 
k_content <- k_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

k_content <- k_content + facet_grid(~ Condition)

k_content <- k_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
k_content <- k_content +scale_color_manual(values = c("mediumblue", "deeppink2"))
k_content <- k_content + ylab("K content, mg/mg dry weight") + xlab("")
k_content <- k_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
k_content <- k_content + rremove("legend")
k_content

pdf("20220610_ICP-MS_Arabidopsis_col_duf-5_shoot_soil_Salt.pdf",width = 13, height = 5 )
plot_grid(Na_content, k_content,labels = c("AUTO"), ncol = 2)
dev.off()
## png 
##   2
aov(Na.K.ratio ~ GenoCon, data = duf_soil_ICP)
## Call:
##    aov(formula = Na.K.ratio ~ GenoCon, data = duf_soil_ICP)
## 
## Terms:
##                   GenoCon Residuals
## Sum of Squares  0.9936397 0.1198656
## Deg. of Freedom         5        43
## 
## Residual standard error: 0.05279747
## Estimated effects may be unbalanced
Output <- TukeyHSD(aov(Na.K.ratio ~ GenoCon, data = duf_soil_ICP))
Output
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Na.K.ratio ~ GenoCon, data = duf_soil_ICP)
## 
## $GenoCon
##                                     diff         lwr         upr     p adj
## control_duf-control_col      0.001440836 -0.07324076  0.07612243 0.9999999
## EarlySalt_col-control_col    0.361616646  0.28289533  0.44033796 0.0000000
## EarlySalt_duf-control_col    0.323834112  0.24234981  0.40531841 0.0000000
## LateSalt_col-control_col     0.210711081  0.13198977  0.28943240 0.0000000
## LateSalt_duf-control_col     0.197163858  0.11844254  0.27588517 0.0000000
## EarlySalt_col-control_duf    0.360175810  0.28549421  0.43485741 0.0000000
## EarlySalt_duf-control_duf    0.322393276  0.24480470  0.39998185 0.0000000
## LateSalt_col-control_duf     0.209270245  0.13458865  0.28395184 0.0000000
## LateSalt_duf-control_duf     0.195723022  0.12104142  0.27040462 0.0000000
## EarlySalt_duf-EarlySalt_col -0.037782535 -0.11926684  0.04370177 0.7369034
## LateSalt_col-EarlySalt_col  -0.150905566 -0.22962688 -0.07218425 0.0000135
## LateSalt_duf-EarlySalt_col  -0.164452788 -0.24317410 -0.08573147 0.0000024
## LateSalt_col-EarlySalt_duf  -0.113123031 -0.19460733 -0.03163873 0.0020742
## LateSalt_duf-EarlySalt_duf  -0.126670254 -0.20815456 -0.04518595 0.0004495
## LateSalt_duf-LateSalt_col   -0.013547223 -0.09226854  0.06517409 0.9953832
P6 = Output$GenoCon[,'p adj']
stat.test<- multcompLetters(P6)
stat.test
##   control_duf EarlySalt_col EarlySalt_duf  LateSalt_col  LateSalt_duf 
##           "a"           "b"           "b"           "c"           "c" 
##   control_col 
##           "a"
test <- as.data.frame(stat.test$Letters)
test$group1 <- rownames(test)
test$group2 <- rownames(test)
colnames(test)[1] <- "Tukey"
test
ABCDEFGHIJ0123456789
 
 
Tukey
<chr>
group1
<chr>
group2
<chr>
control_dufacontrol_dufcontrol_duf
EarlySalt_colbEarlySalt_colEarlySalt_col
EarlySalt_dufbEarlySalt_dufEarlySalt_duf
LateSalt_colcLateSalt_colLateSalt_col
LateSalt_dufcLateSalt_dufLateSalt_duf
control_colacontrol_colcontrol_col
ratio_content <- ggplot(data = duf_soil_ICP, mapping = aes(x = GenoCon, y = Na.K.ratio, colour = Condition)) 
ratio_content <- ratio_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

ratio_content <- ratio_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")

ratio_content <- ratio_content + ylab("Na/K ratio") + xlab("")
ratio_content <- ratio_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
ratio_content <- ratio_content + stat_pvalue_manual(test, label = "Tukey", y.position = 2)
ratio_content

ratio_content <- ggplot(data = duf_soil_ICP, mapping = aes(x = Genotype, y = Na.K.ratio, colour = Genotype)) 
ratio_content <- ratio_content + geom_boxplot(alpha=0.2) + geom_jitter(width=0.1,alpha=0.2)

ratio_content <- ratio_content + facet_grid(~ Condition)

ratio_content <- ratio_content + stat_summary(fun=mean, geom="point", shape=95, size=6, color="black", fill="black")
ratio_content <- ratio_content +scale_color_manual(values = c("mediumblue", "deeppink2"))
ratio_content <- ratio_content + ylab("Na/K ratio") + xlab("")
ratio_content <- ratio_content + theme(axis.text.x = element_text(angle=90, hjust=0.9, vjust=0.5))
ratio_content <- ratio_content + rremove("legend")
ratio_content

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.