'How to obtain an statistic (cohensd) for more than two factors

I want to compute the cohens d value for more than one factor at the same time.

So for example, in the iris dataset we could compute the cohens d for sepal length between setosa and versicolor very easily with:

virginica <- subset(iris, Species =="virginica")
versicolor <- subset(iris, Species =="versicolor")

cohen.d(virginica$Sepal.Length, versicolor$Sepal.Length)

Of course we could replicate this process again for the remaining factor.

In summary, what I want is to obtain the measure of all the factors against one, not all the factors against each other. So it would be like generating several cohensd but just in one step.

In this case, versicolor vs setosa and versicolor vs virginica.

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source