error in for loop with grouped_ggbetweenstats

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 :


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?


To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

I hope that my little data.frame is adequate, and I have give more detail.
Thank for this remark

What is d in the following code? I couldn't find anything about this in the data you posted.

data = dplyr::filter(.data = d,treatment %in% carences)

D is my dataframe. Sorry I have missing to note this in my code

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.