-
Notifications
You must be signed in to change notification settings - Fork 124
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
Change legend values #110
Comments
The values are the labels from the factor. Take a look at the labels
function or the labels parameter of factor.
…On Mon, Jan 20, 2020 at 5:31 PM jamesquinlan ***@***.***> wrote:
How, if possible, can I change the legend values of the Likert plot. In
particular, my data has values 1, 2, 3, 4, 5 for SD, D, N, A, SA. Currently
I run
Read the data
survey=read.csv(thedata)
Select which variables to compare
query=survey[,c(1,2, 3, 4, 6, 7, 8, 9, 10)]
results=likert(Items, grouping = query$Group)
plot(results, type="bar")
The legend at the bottom has "Response 1 2 3 4 5" with color squares. I
want those color squares to correspond to "SD", "D", "N", "A", "SA" instead
of 1-5.
Thanks in advance.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#110?email_source=notifications&email_token=AAEYJD22BX2BYBJYZLPWTOTQ6YQ23A5CNFSM4KJKWMU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IHPAWRQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYJDZCLVLFROOYQBQMCNTQ6YQ23ANCNFSM4KJKWMUQ>
.
|
Thanks, this worked: library(likert)
# Read the data
survey=read.csv(thedata)
# Convert integer data to factor for analysis
survey = survey %>% mutate_if(is.integer, as.factor)
# Set Labels
scale =c("Strongly Disagree", "Disagree", "Neutral","Agree","Strongly Agree")
# Obtain Results (per group)
survey[,c(2:13)] = lapply(survey[,c(2:13)], factor, levels=1:5, labels=scale)
# Select which variables to compare
query=survey[,c(1,2, 3, 4, 6, 7, 8, 9, 10)]
results=likert(Items, grouping = query$Group)
plot(results, type="bar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How, if possible, can I change the legend values of the Likert plot. In particular, my data has values 1, 2, 3, 4, 5 for SD, D, N, A, SA. Currently I run
The legend at the bottom has "Response 1 2 3 4 5" with color squares. I want those color squares to correspond to "SD", "D", "N", "A", "SA" instead of 1-5.
Thanks in advance.
The text was updated successfully, but these errors were encountered: