Hi, I start to use for loop to analyse my data, when I test mys code less for loop it is OK. But with for loop their are error message. I make a little part of my data.frame . My code is :
library("ggstatsplot")
install.packages("ggstatsplot")
install.packages("readxl")
library(readxl)
data.frame(Pot= c("2b","3b","4b","6b","2a","3a","4a","6a"),treatment= c("Mg","Mg","Mg","Mg","T_Mg","T_Mg","T_Mg","T_Mg"),time= c("t1","t1","t1","t1","t1","t1","t1","t1"), tissu= c("st_av","st_av", "st_av", "st_av", "st_av", "st_av", "st_av", "st_av"), Na= c(267, 580, 318, 316, 497, 521, 400, 390), B= c(21, 24.5, 29, 34, 28, 30, 35, 40))
ionome_elements <- c("N","Mg","P","S","K","Ca","B","Cl","Mn","Fe","Ni","Cu","Zn","Mo","Na","Al","Si",'V',"Co","Se")
carences <- c("N","Mg","P","S","K","Ca","B","Mn","Fe","Ni","Cu","Zn","Mo")
T_carence <- c("T_N","T_Mg","T_P","T_S","T_K","T_Ca","T_B","T_Mn","T_Fe","T_Ni","T_Cu","T_Zn","T_Mo")
boucle.carence <- cbind(carences, T_carence)
for (i in 1:length(ionome_elements)) {
boxplot.graph[[ionome_elements[i]]]<-grouped_ggbetweenstats(data = dplyr::filter(.data = d,treatment %in% carences),
x = tissu, xlab="Tissu",
y = ionome_elements[i],ylab = "i",
grouping.var = treatment,
mean.plotting = F, mean.color = "darkblue",
outlier.tagging = TRUE,
outlier.label = "Pot",
outlier.label.color = "black",
ggtheme = ggplot2::theme_gray())
}
Error: Only strings can be converted to symbols
Can you help me please?