Error Message when calculating cohens d: grouping factor must have exactly 2 levels

See the FAQ: How to do a minimal reproducible example reprex for beginners.

There are several different implementations of Cohen's D in different packages. In {lsr} the cohensD function takes as its arguments the data for group 1 first and group 2 second. It's not possible to tell if data$means_needs has levels.