0

我正在尝试使用 Jason Bryer 的“likert”包制作一个李克特图,其中一个分组变量有 6 个级别和两个李克特量表变量,每个变量有 5 个级别:

plot(likert(likert_krise[,2:3], grouping = likert_krise$krise))

当我运行代码时,分组变量的一个级别显示在两行中:条形在第一行中,百分比级别在第二行中。

有人可以向我解释这里发生了什么吗?

我发现很难制作一个可重复的最小示例,但这是我的原始数据:

likert_krise <- structure(list(krise = structure(c(4L, 5L, 4L, 5L, 5L, 5L, 6L, 
2L, 5L, 5L, 4L, 5L, 4L, 5L, 2L, 4L, 1L, 5L, 4L, 2L, 3L, 2L, 4L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 3L, 3L, 4L, 5L, 4L, 5L, 
5L, 5L, 5L, 4L, 5L, 3L, 5L, 2L, 5L, 4L, 5L, 5L, 3L, 4L, 2L, 5L, 
5L, 5L, 6L, 2L, 4L, 4L, 4L, 3L, 5L, 4L, 1L, 3L, 3L, 3L, 5L, 4L, 
4L, 3L, 6L, 5L, 4L, 3L, 2L, 5L, 4L, 4L, 4L, 3L, 5L, 3L, 2L, 3L, 
5L, 3L, 3L, 3L, 4L, 2L, 3L, 2L, 5L, 2L, 3L, 3L, 3L, 4L, 3L, 3L, 
3L, 2L, 5L, 5L, 5L, 5L, 5L, 3L, 4L, 5L, 1L, 3L, 3L, 4L, 5L, 3L, 
5L, 5L, 5L, 5L, 5L, 6L, 4L, 5L, 5L, 4L, 5L, 3L, 5L, 4L, 2L, 2L, 
1L, 2L, 3L, 1L, 2L, 2L, 3L, 2L, 3L, 1L, 1L, 3L, 2L, 2L, 1L, 2L, 
3L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 1L, 2L, 3L, 2L, 5L, 3L, 3L, 3L, 
2L, 2L, 5L, 3L, 4L, 2L, 3L, 5L, 3L, 2L, 4L, 2L, 2L, 5L, 2L, 3L, 
2L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 5L, 2L, 5L, 6L, 5L, 3L, 5L, 5L, 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5L, 3L, 5L, 4L, 
4L, 5L, 4L, 5L, 2L, 4L, 5L, 4L, 4L, 3L, 5L, 5L, 3L, 5L, 3L, 5L, 
2L, 5L, 4L, 5L), .Label = c("Startet og sluttet før", "Startet før, sluttet under", 
"Startet før, sluttet etter ", "Startet og sluttet under", "Startet under, sluttet etter", 
"startet og sluttet etter"), class = "factor"), `Blir den mindreårige hørt?` = structure(c(4L, 
3L, 3L, 3L, 4L, 4L, 4L, 3L, 4L, 4L, 4L, 3L, 4L, 3L, 3L, 5L, 3L, 
3L, 4L, 3L, 3L, 1L, 5L, 3L, 4L, 3L, 4L, 4L, 2L, 3L, 2L, 2L, 3L, 
4L, 2L, 3L, 4L, 3L, 3L, 3L, 4L, 3L, 2L, 4L, 3L, 4L, 3L, 3L, 3L, 
2L, 3L, 3L, 3L, 4L, 4L, 3L, 1L, 3L, 2L, 3L, 3L, 3L, 1L, 4L, 3L, 
3L, 3L, 4L, 3L, 3L, 4L, 3L, 2L, 4L, 3L, 4L, 4L, 4L, 4L, 4L, 1L, 
3L, 5L, 4L, 3L, 3L, 4L, 4L, 4L, 3L, 3L, 4L, 3L, 4L, 2L, 4L, 4L, 
4L, 1L, 3L, 2L, 4L, 4L, 3L, 2L, 3L, 3L, 3L, 4L, 3L, 4L, 3L, 3L, 
3L, 4L, 3L, 4L, 4L, 3L, 3L, 4L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 
4L, 1L, 3L, 4L, 4L, 2L, 4L, 5L, 3L, 4L, 4L, 4L, 3L, 4L, 2L, 2L, 
3L, 4L, 3L, 3L, 3L, 4L, 2L, 4L, 3L, 3L, 4L, 4L, 3L, 3L, 4L, 2L, 
4L, 3L, 3L, 4L, 4L, 4L, 4L, 3L, 4L, 3L, 2L, 3L, 5L, 4L, 2L, 4L, 
3L, 4L, 4L, 3L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 4L, 3L, 4L, 4L, 
4L, 5L, 4L, 4L, 3L, 4L, 3L, 4L, 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4L, 3L, 3L, 2L, 3L, 1L, 3L, 4L, 4L, 3L, 2L, 5L, 
3L, 3L, 2L, 2L, 3L, 3L, 4L, 4L, 4L, 3L), .Label = c("I svært liten grad", 
"I liten grad", "I noen grad", "I stor grad", "I svært stor grad"
), class = "factor"), `Får den mindreårige fram sine synspunkter og argumenter i saken?` = structure(c(5L, 
2L, 3L, 3L, 4L, 3L, 4L, 3L, 3L, 3L, 4L, 3L, 3L, 3L, 3L, 5L, 3L, 
3L, 4L, 4L, 3L, 1L, 4L, 3L, 4L, 4L, 5L, 4L, 3L, 3L, 2L, 2L, 3L, 
5L, 3L, 3L, 5L, 3L, 3L, 4L, 4L, 3L, 3L, 4L, 3L, 3L, 4L, 4L, 3L, 
3L, 4L, 3L, 4L, 5L, 4L, 3L, 1L, 4L, 2L, 3L, 4L, 3L, 4L, 3L, 3L, 
5L, 4L, 4L, 3L, 3L, 4L, 3L, 3L, 4L, 3L, 4L, 4L, 3L, 5L, 4L, 4L, 
3L, 5L, 3L, 3L, 2L, 4L, 4L, 5L, 4L, 2L, 4L, 3L, 4L, 4L, 4L, 4L, 
4L, 3L, 3L, 2L, 3L, 4L, 3L, 2L, 3L, 3L, 3L, 4L, 1L, 3L, 4L, 3L, 
3L, 4L, 4L, 4L, 4L, 3L, 4L, 5L, 2L, 4L, 1L, 4L, 3L, 3L, 4L, 3L, 
4L, 3L, 3L, 4L, 3L, 3L, 4L, 4L, 2L, 4L, 4L, 4L, 3L, 4L, 3L, 3L, 
3L, 4L, 3L, 3L, 3L, 3L, 3L, 4L, 3L, 3L, 4L, 4L, 3L, 3L, 4L, 3L, 
4L, 3L, 2L, 4L, 4L, 3L, 5L, 4L, 4L, 3L, 3L, 3L, 5L, 3L, 2L, 3L, 
4L, 4L, 3L, 3L, 2L, 4L, 3L, 3L, 4L, 4L, 4L, 3L, 4L, 4L, 5L, 3L, 
4L, 4L, 5L, 4L, 3L, 4L, 3L, 4L, 3L, 3L, 4L, 3L, 3L, 4L, 3L, 4L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, 4L, 4L, 4L, 4L, 
4L, 3L, 3L, 2L, 4L, 3L, 4L, 2L, 3L, 3L), .Label = c("I svært liten grad", 
"I liten grad", "I noen grad", "I stor grad", "I svært stor grad"
), class = "factor")), row.names = c(NA, -475L), class = "data.frame", na.action = structure(c(`5` = 5L, 
`28` = 28L, `58` = 58L, `61` = 61L, `62` = 62L, `71` = 71L, `105` = 105L, 
`115` = 115L, `127` = 127L, `135` = 135L, `138` = 138L, `139` = 139L, 
`153` = 153L, `156` = 156L, `162` = 162L, `177` = 177L, `220` = 220L, 
`225` = 225L, `226` = 226L, `234` = 234L, `253` = 253L, `256` = 256L, 
`291` = 291L, `339` = 339L, `340` = 340L, `346` = 346L, `358` = 358L, 
`367` = 367L, `382` = 382L, `417` = 417L, `424` = 424L, `426` = 426L, 
`458` = 458L, `471` = 471L, `498` = 498L, `499` = 499L, `500` = 500L, 
`501` = 501L, `502` = 502L, `504` = 504L, `505` = 505L, `506` = 506L, 
`507` = 507L, `508` = 508L, `509` = 509L, `510` = 510L, `511` = 511L, 
`512` = 512L, `513` = 513L, `514` = 514L, `515` = 515L, `516` = 516L, 
`517` = 517L, `518` = 518L, `519` = 519L, `520` = 520L, `522` = 522L, 
`523` = 523L, `524` = 524L, `525` = 525L, `526` = 526L, `527` = 527L, 
`528` = 528L, `529` = 529L, `530` = 530L, `531` = 531L, `532` = 532L, 
`533` = 533L, `534` = 534L, `536` = 536L, `537` = 537L, `538` = 538L, 
`539` = 539L, `540` = 540L, `541` = 541L, `543` = 543L, `544` = 544L, 
`545` = 545L, `547` = 547L, `549` = 549L, `550` = 550L, `551` = 551L, 
`552` = 552L, `553` = 553L, `554` = 554L, `555` = 555L, `556` = 556L, 
`557` = 557L, `558` = 558L, `559` = 559L, `560` = 560L, `562` = 562L, 
`563` = 563L, `564` = 564L, `565` = 565L, `566` = 566L, `567` = 567L, 
`568` = 568L, `569` = 569L, `570` = 570L, `571` = 571L, `572` = 572L, 
`573` = 573L, `574` = 574L, `575` = 575L, `576` = 576L, `577` = 577L, 
`578` = 578L, `579` = 579L, `580` = 580L, `581` = 581L, `582` = 582L, 
`583` = 583L, `584` = 584L, `585` = 585L, `586` = 586L, `587` = 587L, 
`588` = 588L, `589` = 589L, `590` = 590L, `592` = 592L, `593` = 593L, 
`594` = 594L, `595` = 595L, `596` = 596L, `597` = 597L, `598` = 598L, 
`599` = 599L, `600` = 600L, `601` = 601L, `602` = 602L, `603` = 603L, 
`604` = 604L, `605` = 605L, `606` = 606L, `607` = 607L, `608` = 608L, 
`609` = 609L, `611` = 611L, `612` = 612L, `613` = 613L, `614` = 614L, 
`615` = 615L, `616` = 616L, `617` = 617L, `618` = 618L, `619` = 619L, 
`620` = 620L, `621` = 621L, `623` = 623L, `624` = 624L, `625` = 625L, 
`626` = 626L, `627` = 627L, `628` = 628L, `629` = 629L, `630` = 630L, 
`631` = 631L, `632` = 632L, `633` = 633L, `634` = 634L, `636` = 636L, 
`637` = 637L, `639` = 639L, `640` = 640L, `641` = 641L, `642` = 642L, 
`643` = 643L), class = "omit"))
4

1 回答 1

0

我发现了问题 - 在一个因子级别(“Startet før, sluttet etter”)中,字符和引号之间有一个额外的空格。当我删除它时,问题就消失了。

于 2021-05-07T14:03:10.657 回答