Bonjour, je commence a utiliser les boucles sur R pour analyser mes données. Quand je fais j'utilise la fonction grouped_ggbetweenstats hors de la boucle cela fonctionne. Mais dès que j'essaie de mettre cette fonction au sein d'une boucle un message d'erreur apparait. But with for loop their are error message. J'ai mis une partie de mes données me semblant assez représentatif du global. Mon code est:

Code R : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
Pouvez-vous m'aider s'il vous plait ?