Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with variables label #84

Open
LoSerigne opened this issue Jan 20, 2018 · 3 comments
Open

Issues with variables label #84

LoSerigne opened this issue Jan 20, 2018 · 3 comments

Comments

@LoSerigne
Copy link

I tried to replicate the example in your website “Grouped by country…”. However the output is not exactly the same as the one from the example (see below). As you can notice there is a mess in the variable names, each variable is duplicated with two different formatting, I just wanted to display the first 4 variables grouped by country. Could you please? How could I get the variable label fixed and only display the figure for the 4 variable I wanted? Here are my syntax and the details of my R environment.
Many thanks in advance for your help.
Regards
Serigne

version

platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 4.1
year 2017
month 06
day 30
svn rev 72865
language R
version.string R version 3.4.1 (2017-06-30)
nickname Single Candle

Syntax

require(likert)
ls("package:likert")
data(pisaitems)
items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
head(items28)

items28 <- rename(items28, c(ST24Q01 = "I read only if I have to.", ST24Q02 = "Reading is one of my favorite hobbies.",
ST24Q03 = "I like talking about books with other people.", ST24Q04 = "I find it hard to finish books.", ST24Q05 = "I feel happy if I receive a book as a present.",
ST24Q06 = "For me, reading is a waste of time.", ST24Q07 = "I enjoy going to a bookstore or a library.", ST24Q08 = "I read only to get information that I need.",
ST24Q09 = "I cannot sit still and read for more than a few minutes.", ST24Q10 = "I like to express my opinions about books I have read.",
ST24Q11 = "I like to exchange books with my friends"))

l28g <- likert(items28[,1:4], grouping = pisaitems$CNT)

plot(l28g)

likert_grouped_by_country.pdf

@LoSerigne
Copy link
Author

LoSerigne commented Jan 21, 2018

A quick update,
I've asked my colleague to run the syntax using Mac, IT WORKED FINE! So the issue is really due the Windows environment. Any tips about how to fix the issue?
Regards
Serigne

@RegisBK
Copy link

RegisBK commented Jun 1, 2018

I ran into this problem as well, and it seems like it will plot correctly by groups as long as the name of the item is under 24 characters, if over 24 characters then the name can't have any spaces. Not exactly sure how to fix this other than using abbreviated names instead of the full item text.

require(likert)
ls("package:likert")
data(pisaitems)

## Without renaming, plot is fine
items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
l28g <- likert(items28[,1:4], grouping = pisaitems$CNT)
plot(l28g)

## Using short colnames, plot is fine
items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
colnames(items28) <- c(paste0("Q_", 1:11))

l28g <- likert(items28[,1:4], grouping = pisaitems$CNT)
plot(l28g)

## Using space in short colnames, plot is fine
items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
colnames(items28) <- c(paste(paste0(LETTERS[1:22], collapse = ""), 1:11))

l28g <- likert(items28[,1:4], grouping = pisaitems$CNT)
plot(l28g)

## Using space in long colnames, plot is incorrect
items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
colnames(items28) <- c(paste(paste0(LETTERS[1:23], collapse = ""), 1:11))

l28g <- likert(items28[,1:4], grouping = pisaitems$CNT)
plot(l28g)

## Using no space in long colnames, plot is fine
items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
colnames(items28) <- c(paste0(paste0(LETTERS[1:23], collapse = ""), 1:11))

l28g <- likert(items28[,1:4], grouping = pisaitems$CNT)
plot(l28g)

R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] dplyr_0.7.5 plyr_1.8.4 likert_1.3.6 xtable_1.8-2 ggplot2_2.2.1

@robindecroon
Copy link

Also ran into this issue with likert_1.3.5 Very confusing error message:

Error in `$<-.data.frame`(`*tmp*`, "low", value = c(`1` = 83.3333333333333,  : 
  replacement has 24 rows, data has 25

using shorter variable names as suggested by @RegisBK solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants