0

In sjmisc / sjPlot r packages I've got a variable in which not all the values have 'value labels'. See example:

library ("sjmisc")
library ("sjPlot")
agreement <- sample (1:5, 40, replace = TRUE)
agreement <- set_labels(agreement, c(`1` = "Full agree",`5` = "Full  disagree"))

When I ask for a frequency table some information is lost:

sjt.frq(agreement)

This is what you get:

data
value       N   raw %   valid %     cumulative %
Full agree  4   10.00   10.00       10.00
2           7   17.50   17.50       27.50
missings    0   0.00        
total N=11 · valid N=11 · x̄=3.40 · σ=1.22

Any help? Thank you very much in advance

1 Answers1

0

This is currently a shortcoming with non-complete labelled vectors. You can use following workaround with to_factor:

sjt.frq(to_factor(agreement, add.non.labelled = T))

or, for a console output:

frq(as_labelled(agreement))

I've added this issue, so I can remove this bug in a forthcoming update...

Edit: The bug is fixed in the current GitHub-build, which - however - requires the latest sjmisc-build to run. Updated for CRAN to be submitted the next 2-3 weeks.

Daniel
  • 7,252
  • 6
  • 26
  • 38