Search code examples
rsjplot

sjt.grpmean results inside sjPlot are not correctly displayed


I have a problem with sjPlot command: sjt.grpmean

This is my example:

x <- rnorm(120,1230,220)
f <- c(rep("men",60),rep("women",60))
d <- data.frame(x,f)

library(sjPlot)

sjt.grpmean(var.cnt = d$x,
            var.grp = d$f)

The result is just weird.

I try this:

x <- rnorm(120,1230,220)
f <- as.factor(c(rep("men",60),rep("women",60)))
d <- data.frame(x,f)

library(sjPlot)
sjt.grpmean(var.cnt = d$x,d$f)

With same weird result.

I Can use this workaround:

sjt.grpmean(var.cnt = d$x,
            var.grp = d$f,
            value.labels = c("men","women"))

But, why i need to use value.labels to fix? is this a bug?

I will appreciate any help.

R version 3.3.2 (2016-10-31)

sjPlot 2.3.0


Solution

  • is this a bug?

    Yes, it's a bug you found. I have already fixed it in the current dev-version on GitHub, a CRAN-update may follow in March...