0

Hi to everyone my question is about the use of this parameter.

A quick example:

x <- c(1,1,1,1,2,2,2,2,1,1,1,1,1,2,2)

for this example 1 = yes and 2 = No, then:

sjt.frq(x,
        value.labels = c("yes","no"))

But the result is not showing me the labels.

I try this other method:

lab <- c("Si" = 1, 
         "No" = 2)


sjt.frq(x,
        value.labels = lab)

with no success

I know I can use this workaround:

library(sjmisc)
sjt.frq(add_labels(x,value = lab))

But I want to figure out how to use sjt.frq with value.labels

G5W
  • 36,531
  • 10
  • 47
  • 80
Victor Espinoza
  • 318
  • 1
  • 9

1 Answers1

0

This is a bug in the current version - labelling the output only works for labelled data, argument value.label is not handled properly. You can either wait for a package-update of sjPlot :-) or label your vector:

library(sjPlot)
library(sjmisc)
x <- c(1,1,1,1,2,2,2,2,1,1,1,1,1,2,2)
x <- set_labels(x, labels = c("si", "non"))
sjt.frq(x)

sjt.frq(x, value.labels = c("yes","no")) would be correct if the bug is fixed. I committed a fix to GitHub (https://github.com/sjPlot), so you could install the current build to make sjt.frq() work correct.

Daniel
  • 7,252
  • 6
  • 26
  • 38
  • Thanks. I was wondering how this work? Now i know is a bug. I looked in github, and notice the fix. I will try github. Thanks you very much! Gracias! – Victor Espinoza Feb 18 '17 at 12:57