Help with this error: Error in eval(YVAR, Environment(formula), globalenv()) : object 'Growth' not found

I am trying to perform a PERMANOVA analysis on my data, where I have two independent variables (Treatment and Time) and one response variable (Growth), using the following code:

resultado_adonis <- adonis2(Growth ~ Treatment*Time, data = dados, method = "bray")

However, I'm receiving the following error: Error in eval(YVAR, environment(formula), globalenv()) :
object 'Growth' not found

and my data has a column for growth.

Growth or growth? R is case-sensitive.

sorry it was just an oversight at the time of typing, but I already checked the column name to find possible errors but everything is fine

Okay, I was hoping it was that easy.

We are going to need a lot more information. Basically we need enough code for a reproducible example ,or reprex (otherwise know as a minimal working example and a sample of your data.

See FAQ Asking Questions

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here.

dput(dados)
structure(list(Tempo = c(12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L,
36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L,
36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L,
36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 36L,
36L, 36L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
48L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L,
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L,
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L,
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L,
72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L,
72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L,
72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L,
72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 72L, 84L,
84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L,
84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L,
84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L,
84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 96L, 96L,
96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L,
96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L,
96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L,
96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L), Tratamento = c("C",
"C", "C", "T1", "T1", "T1", "T2", "T2", "T2", "T3", "T3", "T3",
"T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6", "T6", "T7", "T7",
"T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10", "T10", "T10",
"T11", "T11", "T11", "T12", "T12", "T12", "T13", "T13", "T13",
"T14", "T14", "T14", "T15", "T15", "T15", "T16", "T16", "T16",
"C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2", "T3", "T3",
"T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6", "T6", "T7",
"T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10", "T10",
"T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13", "T13",
"T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16", "T16",
"T16", "C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2", "T3",
"T3", "T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6", "T6",
"T7", "T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10",
"T10", "T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13",
"T13", "T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16",
"T16", "T16", "C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2",
"T3", "T3", "T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6",
"T6", "T7", "T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10",
"T10", "T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13",
"T13", "T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16",
"T16", "T16", "C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2",
"T3", "T3", "T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6",
"T6", "T7", "T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10",
"T10", "T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13",
"T13", "T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16",
"T16", "T16", "C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2",
"T3", "T3", "T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6",
"T6", "T7", "T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10",
"T10", "T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13",
"T13", "T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16",
"T16", "T16", "C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2",
"T3", "T3", "T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6",
"T6", "T7", "T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10",
"T10", "T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13",
"T13", "T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16",
"T16", "T16", "C", "C", "C", "T1", "T1", "T1", "T2", "T2", "T2",
"T3", "T3", "T3", "T4", "T4", "T4", "T5", "T5", "T5", "T6", "T6",
"T6", "T7", "T7", "T7", "T8", "T8", "T8", "T9", "T9", "T9", "T10",
"T10", "T10", "T11", "T11", "T11", "T12", "T12", "T12", "T13",
"T13", "T13", "T14", "T14", "T14", "T15", "T15", "T15", "T16",
"T16", "T16"), Repeticao = c("R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2",
"R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1",
"R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3", "R1", "R2", "R3",
"R1", "R2", "R3", "R1", "R2", "R3"), Crescimento = c(0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.26, 0.25, 0.29, 0.25, 0.3, 0.26, 0.23, 0.27,
0.25, 0.22, 0.26, 0.27, 0.22, 0.23, 0.23, 0.21, 0.23, 0.28, 0.29,
0.27, 0.25, 0.25, 0.26, 0.26, 0.25, 0.25, 0.22, 0.27, 0.26, 0.25,
0.25, 0.25, 0.27, 0.25, 0.25, 0.22, 0.24, 0.25, 0.23, 0.22, 0.26,
0.27, 0.23, 0.27, 0.25, 0.25, 0.3, 0.26, 0.26, 0.25, 0.29, 0.59,
0.64, 0.64, 0.74, 0.79, 0.6, 0.68, 0.75, 0.61, 0.6, 0.74, 0.55,
0.67, 0.62, 0.72, 0.58, 0.76, 0.83, 0.8, 0.72, 0.78, 0.8, 0.82,
0.85, 0.76, 0.76, 0.71, 0.8, 0.78, 0.81, 0.78, 0.78, 0.84, 0.69,
0.67, 0.68, 0.7, 0.71, 0.67, 0.67, 0.73, 0.77, 0.66, 0.77, 0.55,
0.68, 0.57, 0.71, 0.68, 0.57, 0.7, 1.02, 1.15, 1.06, 1.25, 1.42,
1.06, 1.14, 1.22, 1.05, 1.01, 1.19, 0.99, 1.05, 1.14, 1.35, 1.02,
1.37, 1.41, 1.38, 1.27, 1.3, 1.33, 1.35, 1.4, 1.28, 1.35, 1.14,
1.21, 1.23, 1.33, 1.21, 1.23, 1.44, 1.11, 1.1, 1.18, 1.17, 1.16,
1.1, 1.16, 1.17, 1.2, 1.12, 1.21, 1, 0.96, 0.98, 1.08, 1.14,
0.97, 1.11, 1.6, 1.78, 1.48, 1.9, 2, 1.64, 1.81, 1.81, 1.85,
1.66, 1.91, 1.52, 1.65, 1.75, 2.18, 1.46, 2.22, 2.32, 2.32, 1.93,
1.99, 2.07, 2.11, 2.42, 1.65, 1.84, 1.49, 1.66, 1.55, 2.02, 1.69,
1.67, 1.86, 1.55, 1.46, 1.47, 1.47, 1.4, 1.45, 1.53, 1.56, 1.55,
1.3, 1.48, 1.18, 1.15, 1.22, 1.35, 1.47, 1.14, 1.27, 2.19, 2.48,
2.18, 2.67, 2.72, 2.38, 2.53, 2.44, 2.53, 2.34, 2.6, 2.3, 2.1,
2.6, 3.21, 2.02, 3.3, 3.29, 3.33, 3.01, 2.87, 2.82, 2.99, 3.29,
2.37, 2.54, 2.14, 2.07, 1.99, 2.89, 2.47, 2.09, 2.19, 1.97, 1.74,
1.82, 2.01, 1.78, 2.02, 2.03, 2.39, 2.08, 1.62, 1.87, 1.74, 1.4,
1.52, 1.68, 1.8, 1.43, 1.57, 2.91, 3.36, 2.65, 3.45, 3.29, 3.67,
3.47, 2.86, 3.1, 2.74, 3.21, 2.9, 2.52, 3.09, 4.18, 2.57, 3.82,
4.4, 4.08, 3.49, 4.03, 3.63, 3.45, 4.23, 2.68, 3.47, 2.88, 2.33,
2.28, 3.55, 2.91, 2.66, 2.67, 2.53, 2.11, 2.14, 2.35, 2.16, 2.29,
2.67, 2.47, 2.46, 1.95, 2.06, 1.78, 1.77, 1.81, 1.79, 2.19, 1.66,
1.75, 3.27, 3.65, 2.89, 4.07, 3.93, 4.03, 3.62, 3.84, 3.84, 3.32,
3.96, 3.73, 3.09, 3.91, 4.81, 3.01, 4.56, 4.61, 5.02, 4.13, 4.74,
4.09, 4.09, 5.08, 2.93, 4.09, 3.25, 2.86, 2.78, 4.48, 3.51, 3.27,
3.18, 2.68, 2.48, 2.54, 2.45, 2.62, 3.22, 2.94, 3.02, 2.67, 2.16,
2.49, 2.3, 2.14, 2.12, 2.14, 2.5, 2.11, 2.11)), class = "data.frame", row.names = c(NA,
-408L))

Thank you the data came through with no problem but can you supply more of your actual code?

You say you are doing a PERMANOVA analysis. I presume that the adonis2 function is doing this? What package is it from?

We really should have all of the relevant code, including packages loaded particularly as it is possible conflicts between packages can cause problems.

Have a look at https://reprex.tidyverse.org for some ideas on what we might need.

I see that the columns in your data are Tempo, Tratamento, Repeticao, and Crescimento but in your first post the column names are Growth, Treatment, and Time. Should the code be

resultado_adonis <- adonis2(Crescimento ~ Tratamento*Tempo, data = dados, method = "bray")

This is actually the code I'm using. In the first text, it was put in English just to facilitate understanding, but in my data the variables are in Portuguese and I used them as they are in the spreadsheet.

This is the entire code that I'm trying to use

######## analise ensaio germinacao L. sativa ########

setwd("C:/germinacao")
dir()

read.table("crescimento_radicular_total.txt" , h = T)

dados<-read.table("crescimento_radicular_total.txt" , h = T)

str(dados)

Carregar pacotes necessários

library(vegan)

?adonis2

resultado_adonis <- adonis2(Crescimento ~ Tratamento*Tempo, data = dados, method = "bray")

Thanks for all attencion!

http://localhost:21463/session/vain-paca_reprex_preview.html

Well, I think I see what the problem is but I do not know enough to know what to do about it .

You are regressing a vector vs two other vectors in a single data.frame.

From help(adonis2)
The left-hand side (LHS) of the formula must be either a community data matrix or a dissimilarity matrix, e.g., from vegdist or dist .

If we look at the example we see

data(dune)
data(dune.env)
## default test by terms
adonis2(dune ~ Management*A1, data = dune.env)

Both dune and dune.env are data.frames. adonis2 seems to be regressing the matrix in dune against two variables in dune.env.

After that I'm lost as I do not see where the information in the matrix comes from.

Let's hope someone with a knowledge of these techniques comes along.

I am sorry not to be of more help.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.