Hello, I would like to perform a test of homogeneity for my data but I am struggling with erros. Please help.
bartlett.test(citaloprampodsebou$namount,citaloprampodsebou$nconcentration)
Error in bartlett.test.default(citaloprampodsebou$namount, citaloprampodsebou$nconcentration) :
all observations are in the same group
Well, the error message is clear: all lines in nconcentration have the same value, so all observations are in the same group. You might need to use rbind() to assemble a data frame with both the nominal and actual values.
Or you can use pivot_longer() to transform your "wide" dataset to a "long" one.
The error message suggests that there is no column nconcentration in datacitalopram. Perhaps you could use citaloprampodsebou if that's better? I don't know what your data actually looks like.
Anyway, you can't pivot the data.frame if it contains nconcentration and aconcentration, so you'll need to ignore these columns as you did above:
This are the data. There to two different values (nominal and actual)
nconcentration namount aconcentrataiaomn ount
nominal 8000 actual 8110
nominal 1000 actual 864.93
nominal 100 actual 81.51
nominal 10 actual 9.2
nominal 1 actual 1.41
nominal 1000 actual 973.98
nominal 100 actual 65.74
nominal 10 actual 8.3
nominal 1 actual 0.97
nominal 1000 actual 1017.97
nominal 100 actual 70.5
nominal 10 actual 8.74
nominal 1 actual 0.83
nominal 15 actual 7
nominal 1.5 actual 1.8
nominal 1.5 actual 0.79
nominal 0.15 actual 0.09
nominal 1.5 actual 1.01
nominal 0.15 actual 0.09
nominal 1 actual 0.81
nominal 3000 actual 2641
nominal 3 actual 2.3
nominal 300 actual 284
nominal 0.3 actual 0.2
nominal 30000 actual 23200
nominal 23.2 actual 15
nominal 0.5 actual 0.4
nominal 0.1 actual 0.1
nominal 0.5 actual 0.59595
nominal 8000 actual 5600
nominal 2000 actual 1567
nominal 500 actual 373
nominal 125 actual 98
nominal 31 actual 26
nominal 0.24 actual 0.113
nominal 2.401 actual 1.66
Makes sense. Then easiest is to use c(datacitalopram$nominal, datacitalopram$actual) as input for x in bartlett.test(), and build input g using rep() and nrow(datacitalopram).