0

I am wanting to add on a summary percentage for the total positive and total negative to graphs produced using the HH likert package (as shown in the example image). My data is already formatted as a percentage and the code I am using is as follows.

enter image description here

The data looks like this:

    Segment Very uncomfortable Quite uncomfortable Quite comfortable Very comfortable
1 Segment1           6.905055           36.991369          47.22565         5.672010
2 Segment2           2.359882           16.912488          57.91544        14.847591
3 Segment3          12.325581           12.093023          25.34884         7.674419
4 Segment4           2.560976            8.170732          27.68293        61.341463
5 Segment5           5.516014           12.900356          47.06406        32.562278
6 Segment6          36.829268           24.634146          23.65854         8.536585

And the code I am using is:

 p1<-HH::likert(Segment ~ ., CD9_1_table, main="", ReferenceZero=2.5,
                   col=c("#F2613B", "#F69279", "#89DCCA", "#00AA86"),
                   xlab="", ylab="",
                   scales.in = list(list(col=1,tck=c(0,0)), x = list(at = seq(from = -100, to = 100, by = 50), labels = paste(seq(from=-100, to=100, by=50),'%',sep=''))), 
                   xlimEqualLeftRight=TRUE,
                   par.settings.in =list(axis.line = list(col = 0)))
        
        p2<-HH::likert(Segment ~ ., CD9_1_dk, ReferenceZero=0,main="", xlab="", ylab="",xlim=c(0,50),
                       col=c("grey"),  scales.in = list(x = list(at = seq(from = 0, to = 50, by = 50), labels = paste(seq(from=0, to=50, by=50),'%',sep='')), y=list(labels=c("","","","","",""))),
                       par.settings.in =list(axis.line = list(col = 0)))
        
        print(p1, position = c(0, 0, 0.75, 1), more = TRUE)
        print(p2, position = c(0.75, 0, 1, 1))
    
       
clarke19
  • 15
  • 3
  • 1) What do `39%`, `46%` and `15%` represent in the first row in the plot? 2) Why does `Segment1` sum up to `96.79`? – VitaminB16 Nov 29 '21 at 14:58
  • I would suggest loading the `HH` package instead of calling from `::` - this loads a few other packages that may facilitate what you need - see here for a similar (though not the same) question that may get you started https://stackoverflow.com/questions/37761096/likert-plot-showing-percentage-values – jpsmith Nov 29 '21 at 15:53
  • Sorry should have explained further (the % were just random but an example) the left would be the net negative (uncomfortable), the right the net positive (comfortable), and the third the don't know responses (split out into a separate dataframe to make the second plot). The numbers were just illustrative - the real ones would be e.g. 44% for the net negative segment 1. They don't sum to 100 as the dks are excluded – clarke19 Nov 29 '21 at 15:54

0 Answers0