1

I have issues trying to create a likert plot with two groups. I realized a survey in two communities. I now want to compare these two communities. [That's my data frame][1]. So far, I have loaded a sheet with 3 columns. One column refers to the location (community1, community2), one includes the answers regarding econ_comm (1-6) and one includes the answers regarding future_persp (1-6). I created a likert-object and a first figure.

g_likert = likert(g[1:6])
plot(g_likert, ordered = FALSE, group.order = names(g[2:3]))

...and it worked. Following is what I got so far. [![enter image description here][2]][2]

I assume it's now important to create a both-object first: both<-g$Location (worked)

Now I'm starting to get trouble. The following code shows me errors:

both_likert_2 = likert(both[, c(1:3), drop=FALSE], grouping = both$location)
plot(both_likert_2, include.histogram = TRUE)

The errors are:

Error in [.data.frame (g, 1:6) : undefined columns selected

Error in [.default (both, , c(1:3), drop = FALSE) : wrong number of dimensions - Objekt 'both_likert_2' not found

[I have now also attached a screenshot of my R, just to make sure.][4] I'm struggling for quite some time now and I would be very very grateful for some help. Best, Felix

EDIT: [![This is my current situation in R][5]][5] Here's my code to reproduce it:

library(likert)
g<-read.csv2("C:/Users/felix/OneDrive/Documents/R/SurveyData2.csv", sep=";", dec=",", header=TRUE)
both<-g$Location
g <-  within(g, {
  gold_21cent <- factor(gold_21cent, levels=1:6, labels=c("Completely agree", "Agree", "Slightly agree", "Slightly disagree", "Disagree", "Completely disagree"))
  future_persp <- factor(future_persp, levels=1:6, labels=c("Completely agree", "Agree", "Slightly agree", "Slightly disagree", "Disagree", "Completely disagree"))
 jobs_comm <- factor(jobs_comm, levels=1:6, labels=c("Completely agree", "Agree", "Slightly agree", "Slightly disagree", "Disagree", "Completely disagree"))
} )
.........etc............
comm_likert = likert(g[,2:14], grouping=g[,1])
plot(comm_likert)
library(dplyr)
g %>%

rename(It offers important economic perspectives=future_persp, It provides economic prosperity to the community=econ_comm) %>% likert(grouping=Location) %>% plot()

EDIT: Using dput(g)

structure(list(Location = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L), .Label = c("Huan", "TP"), class = "factor"), 
gold_21cent = structure(c(6L, 6L, 3L, 3L, 2L, 2L, 2L, 2L, 
2L, 6L, 3L, 2L, 2L, 3L, 2L, 3L, 1L, 3L, 2L, NA, NA, 1L, 1L,
6L, 4L, 6L, 5L, 2L, 2L, 2L, 4L, 4L, 3L, 3L, 2L, 3L, 2L, 3L, 
3L, NA, 2L, 3L, 2L, NA, 2L, 2L, 3L, 5L, 3L, 3L, 3L, 3L, 3L, 
3L, 4L, 2L, 3L, 6L), .Label = c("Completely agree", "Agree", 
"Slightly agree", "Slightly disagree", "Disagree", "Completely disagree"
), class = "factor"), life_quality = structure(c(3L, 3L, 
6L, 6L, 5L, 5L, 6L, 5L, 6L, 3L, 3L, 6L, 4L, 6L, 6L, 6L, 6L, 
6L, 6L, NA, NA, 3L, 5L, 6L, 2L, 6L, 5L, 3L, 2L, 3L, 1L, 1L, 
2L, 2L, 3L, 1L, 3L, 2L, 3L, 1L, 3L, 3L, 2L, 3L, 1L, 2L, NA, 
3L, 2L, 2L, 3L, 3L, 3L, 5L, 5L, 3L, 2L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), coexist_tradact = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 2L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, 5L, 5L, 6L, 2L, 6L, 1L, 6L, 5L, 6L, 6L, 6L, 1L, 
4L, 2L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 4L, 3L, 2L, 3L, 3L, 3L, 
4L, 4L, 3L, 2L, 4L, 5L, 4L, 2L, 4L, 6L, 3L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), emigration_comm = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 5L, NA, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, NA, NA, 4L, 2L, 1L, 3L, 1L, 1L, 6L, 6L, 6L, 2L, 
1L, 3L, 3L, 3L, 1L, 3L, 1L, 2L, 1L, 2L, 2L, 3L, 3L, 2L, 1L, 
4L, 5L, 5L, 2L, 3L, 3L, 3L, 2L, 2L, 3L, 3L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), future_persp = structure(c(3L, 
3L, 5L, 5L, 5L, 5L, 6L, 5L, 5L, 3L, 5L, 6L, 6L, 5L, 3L, 6L, 
5L, 5L, 3L, 3L, 3L, 2L, 1L, 6L, 3L, 6L, 5L, 3L, 3L, 3L, 1L, 
3L, 2L, 2L, 2L, 2L, 3L, 3L, 4L, 2L, 4L, 2L, 2L, 3L, 1L, 2L, 
4L, 4L, 4L, 2L, 4L, 2L, 3L, 5L, 5L, 3L, 2L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), workers_comm = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 2L, 6L, 6L, 
6L, 6L, 6L, 4L, 5L, NA, 1L, 6L, 1L, 6L, 5L, 6L, 6L, 6L, 1L, 
2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 3L, 
3L, 3L, 3L, 1L, 4L, 3L, 4L, 5L, 3L, 3L, 4L, 4L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), work_project = structure(c(6L, 
6L, 6L, 6L, 5L, 5L, 6L, 5L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 5L, 3L, 6L, 4L, 6L, 5L, 6L, 6L, 6L, 6L, 
3L, 2L, 2L, 1L, 1L, 3L, 6L, 3L, 3L, 2L, 6L, 3L, 3L, 3L, 1L, 
3L, 6L, 5L, 6L, 5L, 1L, 6L, 6L, 5L, 6L, 2L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), agree_comm = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 6L, 5L, 6L, 
6L, 6L, 6L, 5L, 5L, 5L, 3L, 6L, 2L, 5L, 6L, 6L, 6L, 6L, 3L, 
3L, 2L, 3L, 3L, 1L, 3L, 3L, 3L, 2L, 4L, 1L, 3L, NA, 3L, 2L, 
3L, 3L, NA, 3L, 3L, 4L, 3L, 3L, 3L, 4L, 2L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), informed_deals = structure(c(4L, 
4L, 1L, 1L, 5L, 6L, 5L, 5L, 5L, 6L, 4L, 5L, 5L, 6L, 4L, 6L, 
5L, 6L, 4L, 6L, 6L, 6L, 1L, 6L, 3L, 6L, 1L, 2L, 2L, 2L, 4L, 
2L, 3L, 3L, 2L, 1L, 5L, 6L, 5L, 2L, 3L, 5L, 3L, 3L, 4L, 4L, 
2L, 4L, 4L, 5L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), fear_environ = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 5L, 1L, 
1L, 1L, 1L, 6L, 6L, 1L, 2L, 1L, 4L, 1L, NA, 1L, 1L, 1L, 4L, 
4L, 3L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 2L, 2L, 2L, 1L, 
NA, 1L, 1L, 2L, 2L, 2L, 3L, 1L, 2L, 2L, 3L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), water_quant = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 1L, 2L, 1L, 
1L, 1L, 6L, 6L, 6L, 5L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
3L, 2L, 1L, 2L, 3L, 1L, 3L, 2L, 3L, 1L, 3L, 3L, NA, 2L, 1L, 
5L, 1L, 1L, 2L, 4L, 1L, 3L, 1L, 2L, 3L, 3L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), support_govern = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 5L, 6L, 6L, 4L, 5L, 6L, 1L, 5L, 6L, 3L, 3L, 3L, 3L, 
3L, 2L, 3L, 3L, 2L, 5L, 5L, 3L, 2L, 4L, 3L, 3L, NA, 1L, 1L, 
2L, 6L, 3L, 3L, 3L, 4L, 4L, 6L, 4L, 4L, 3L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), proud_comm = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 1L, 1L, 1L, 
3L, 1L, 2L, 1L, 1L, 2L, 5L, 2L, 1L, 2L, 2L, 2L, NA, 1L, 1L, 
2L, 2L, 2L, 2L, 2L, 3L, 1L, 2L, 1L, 3L, 2L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), econ_comm = structure(c(6L, 
6L, 6L, 6L, 5L, 6L, 5L, 5L, 6L, 6L, 3L, 6L, 6L, 5L, 3L, 5L, 
3L, 4L, 5L, 2L, 2L, 5L, 5L, 6L, 2L, 6L, 5L, 5L, 5L, 5L, 3L, 
2L, 3L, 3L, 1L, 1L, 3L, 2L, 3L, 2L, 3L, 3L, 3L, 2L, 3L, 1L, 
3L, 2L, 3L, 1L, 5L, 3L, 2L, 5L, 2L, 6L, 3L, 4L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), jobs_comm = structure(c(6L, 
6L, 4L, 4L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 4L, 6L, 4L, 
6L, 4L, 5L, 5L, 5L, 3L, 2L, 6L, 1L, 6L, 5L, 5L, 5L, 5L, 2L, 
2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 
2L, 2L, 2L, 1L, 5L, 2L, 3L, 4L, 2L, 2L, 3L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), inequality_comm = structure(c(1L, 
1L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 1L, 3L, 6L, 1L, 2L, 6L, 2L, 
6L, 2L, 6L, NA, NA, 5L, 1L, 6L, 3L, 6L, 5L, 5L, 5L, 5L, 1L, 
3L, 3L, 2L, 3L, 4L, 2L, 3L, 4L, 3L, 2L, 4L, 3L, 3L, 5L, 3L, 
4L, 5L, 3L, 1L, 4L, 3L, 4L, 2L, 3L, NA, 3L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), exp_growth = structure(c(6L, 
6L, 4L, 4L, 6L, 6L, 6L, 5L, 6L, 6L, 4L, 4L, 6L, 2L, 2L, 2L, 
5L, 2L, 3L, NA, NA, 3L, 3L, 6L, 1L, 6L, 5L, 3L, 2L, 6L, 4L, 
2L, 2L, 3L, 2L, 3L, 5L, 2L, 3L, 2L, 3L, 4L, 2L, 3L, 2L, 1L, 
2L, 5L, 3L, 4L, 2L, 4L, 2L, 6L, 3L, 3L, 3L, 3L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), future_region = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
5L, 6L, 5L, 2L, 2L, 2L, 2L, 6L, 3L, 6L, 5L, 6L, 6L, 3L, 4L, 
2L, 3L, 3L, 2L, 4L, 5L, 5L, 5L, 2L, 4L, 2L, 4L, 3L, 4L, 1L, 
NA, 6L, 3L, 3L, 3L, 4L, 3L, 4L, 5L, 5L, 2L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), contamination_environ = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 1L, 6L, 1L, 
6L, 1L, 1L, 6L, 6L, 6L, 4L, 1L, 4L, 6L, 1L, 1L, 1L, 1L, 4L, 
1L, 2L, 1L, 3L, 3L, 1L, 2L, 1L, 3L, 3L, 5L, 2L, 2L, 1L, 1L, 
NA, 1L, 1L, 1L, 1L, 5L, 2L, 1L, 3L, 2L, 3L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), conflicts_comm = structure(c(6L, 
6L, 1L, 1L, 6L, 6L, 6L, 6L, 6L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 
2L, 1L, 6L, 5L, 5L, 5L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 4L, 
3L, 3L, 3L, 3L, 1L, 3L, 2L, 4L, 3L, 3L, 4L, 3L, NA, 4L, 2L, 
3L, 2L, 3L, 3L, 5L, 4L, 4L, 1L, 3L, 5L, 3L, 4L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), infrastructure_comm = structure(c(6L, 
6L, 6L, 6L, 6L, 6L, 6L, 5L, 6L, 6L, 4L, 6L, 5L, 6L, 5L, 6L, 
5L, 6L, 3L, 3L, 3L, NA, 1L, 6L, 1L, 6L, 6L, 4L, 4L, 3L, 1L, 
4L, 3L, NA, 3L, 1L, 5L, 6L, 2L, 3L, 3L, 4L, 3L, 2L, 1L, 2L, 
2L, 4L, 2L, 3L, 6L, 4L, 3L, 3L, 3L, 3L, 2L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), included_mining = structure(c(1L, 
1L, 1L, 1L, 5L, 6L, 6L, 6L, 6L, 6L, 3L, 6L, 6L, 6L, 5L, 6L, 
6L, 6L, 3L, 5L, 5L, 6L, 3L, NA, 3L, NA, NA, 6L, 5L, 5L, 1L, 
3L, 3L, 3L, 3L, 5L, 4L, 6L, 3L, 3L, 2L, 6L, 2L, NA, 2L, 3L, 
2L, 5L, 5L, 3L, 5L, 3L, 3L, 2L, 4L, 5L, 3L, NA), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), investment_region = structure(c(1L, 
1L, 3L, 3L, 6L, 6L, 6L, 5L, 6L, 1L, 2L, 1L, 6L, 2L, 4L, 1L, 
2L, 2L, 3L, NA, NA, 4L, 1L, 5L, 3L, 5L, 5L, 1L, 2L, 2L, 4L, 
2L, 2L, 2L, 4L, 1L, 2L, 3L, 3L, 2L, 3L, 1L, 3L, NA, 3L, 2L, 
NA, 2L, 3L, 3L, 4L, 4L, 3L, 3L, 2L, 2L, 2L, 4L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor"), water_qual = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 6L, 5L, 5L, 5L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
4L, 3L, 1L, 2L, 3L, 1L, 3L, 2L, 3L, 1L, 3L, 3L, NA, 3L, 1L, 
4L, 1L, 1L, 3L, 4L, 2L, 2L, 1L, 2L, 3L, 3L, 2L), .Label = c("Completely agree", 
"Agree", "Slightly agree", "Slightly disagree", "Disagree", 
"Completely disagree"), class = "factor")), row.names = c(NA, 

-58L), class = "data.frame")

Félix
  • 13
  • 4
  • You need to share some reproducible data. – s_baldur Feb 10 '20 at 08:11
  • you mean by uploading my data frame or csv sheet? – Félix Feb 10 '20 at 08:32
  • read in as data.frame and then share as few lines as necessary with `dput()`. More explanation/ideas: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – s_baldur Feb 10 '20 at 08:42
  • hmm i don't know i got that right, I've now uploaded some more data to the post to make it more understandable for you. – Félix Feb 11 '20 at 06:54

1 Answers1

1

I think you just made a simple typing error. And you don't really need to create the both vector, as you can pass the grouping variable within the function call. Try:

both_likert_2 = likert(g[, c(1:3), drop=FALSE], grouping = g$Location)

Edit: Based on the new information provided, how about this:

g <-  within(g, {
  future_persp <- factor(future_persp, levels=1:6)
  econ_comm <- factor(econ_comm, levels=1:6)
} )

comm_likert = likert(g[,2:3], grouping=g[,1])
plot(comm_likert)

Edit: OP wanted to change y-axis tick labels to something more appropriate. Change the names of the columns, but use dplyr so that you don't have to make permanent changes:

library(dplyr)
g %>%
   dplyr::select(future_persp, econ_comm) %>%
   rename(`It offers important economic perspectives`=future_persp,
          `It provides economic prosperity to the community`=econ_comm) %>%
   likert(grouping=g[, "Location"]) %>%
   plot()
Edward
  • 10,360
  • 2
  • 11
  • 26
  • 1
    Hi and welcome to stackoverflow, and thank you for answering. While this code might answer the question, can you consider adding some explanation for what the problem was you solved, and how you solved it? This will help future readers to understand your answer better and learn from it. – Plutian Feb 10 '20 at 08:59
  • Hi Edward, thanks for your reply. That seems to work, but when plotting I now get the answer that: "Error in `$<-.data.frame`(`*tmp*`, "low", value = c(`NA` = NA_real_, NA.1 = NA_real_, : replacement has 3 rows, data has 0" – Félix Feb 10 '20 at 09:30
  • Difficult to diagnose without some data. I wonder if you need all 6 columns: `both_likert_2 = likert(g[, c(1:6), drop=FALSE], grouping = g$Location)` – Edward Feb 10 '20 at 11:58
  • Hi Edward, probably not!? Actually I just have three columns in my data frame. I have now uploaded some more data to this post, to make it more understandable. Thank you very much for your help!! – Félix Feb 11 '20 at 06:55
  • Hi Edward, Thanks again for your reply. Well, I get the error that: > comm_likert = likert(g[,2:3], grouping=g[,1]) Error in likert(g[, 2:3], grouping = g[, 1]) : All items (columns) must have the same number of levels Additionally: Warning: In likert(g[, 2:3], grouping = g[, 1]) : items parameter contains non-factors. Will convert to factors – Félix Feb 12 '20 at 07:35
  • Then, the plot cannot be realized: > plot(comm_likert) Error in `$<-.data.frame`(`*tmp*`, "low", value = c(`NA` = NA_real_, NA.1 = NA_real_ : replacement has 2 rows, data has 0 – Félix Feb 12 '20 at 07:37
  • I'm not sure whether I really need the "# Convert values to factors" part. It seems to destroy my data somehow?! I'm starting to get a bit desperate... – Félix Feb 12 '20 at 07:38
  • The error does indeed suggest that the columns must be factor AND have the same number of levels. So,... – Edward Feb 12 '20 at 07:48
  • hmmm, what would you suggest? – Félix Feb 12 '20 at 07:55
  • 1
    Dear Edward, you really made my day. That's absolutely amazing. Thank you very very much for your help. I will now try to load all the questions (23 in total) and to include them into this framework. Moreover, I would love to rename the Responses and the Communities into real names and answers. – Félix Feb 12 '20 at 08:19
  • Dear Edward, may I again ask you for your help? I'm trying to rename the responses 1-6 into "Completely agree", "Agree", "Slightly agree", etc. Moreover, I would love to change the variable names like "future_persp" into the original sentences, like "It offers important economic perspectives". Do you have a hint for me how to do that? – Félix Feb 17 '20 at 08:49
  • Without diving into R, I would *guess* that all you need to do is add a `labels` argument to the `factor` command: `future_persp <- factor(future_persp, levels=1:6, labels=c("Completely agree", "Agree", ...))`. As for the variable names, I'd leave them alone within the data and add them when you create the plot. I'll need to look at the help page though because you're using a third-party package... – Edward Feb 17 '20 at 09:52
  • Hi Edward, thank you for your help!! changing the responses worked absolutely perfect. So far, It did not work to change the variable names. At the moment I get this error: Error in likert(., grouping = Community) : All items (columns) must have the same number of levels – Félix Feb 20 '20 at 08:38
  • Oh, I made a typo. See my edit. Just change `Community` to `Location`. – Edward Feb 20 '20 at 08:43
  • hmmm I still get the same error: Error in likert(., grouping = location) : All items (columns) must have the same number of levels – Félix Feb 20 '20 at 09:48
  • Location (not location). R is case sensitive. Or just put whatever the name is for the variable that contains the groupings. – Edward Feb 20 '20 at 09:57
  • If still error, could you please `dput` your data by editing your question? – Edward Feb 20 '20 at 10:03
  • Thats true, I should know that at this point. Yes, location is the variable that contains the groupings, but it still does not make a difference... Error in likert(., grouping = Location) : All items (columns) must have the same number of levels --- I now edit my question! – Félix Feb 20 '20 at 10:25
  • + `It provides economic prosperity to the community`=econ_comm) %>% Error: Unexpected) ')' in: "g %>% `It provides economic prosperity to the community`=econ_comm)" > likert(grouping=g[, "Location") %>% Error: Enexpected) ')' in " likert(grouping=g[, "Location")" – Félix Feb 20 '20 at 10:41
  • Try again with the new commands. If not, then can you `dput()` your data frame? It's really difficult without having your data (as the very first commentator asked you to do). – Edward Feb 20 '20 at 10:44
  • I would love to send it to you. Do you mean dput(g)? – Félix Feb 20 '20 at 10:57
  • Is it understandable like that? – Félix Feb 20 '20 at 11:09
  • Yes. Thank you. :) I missed a trailing "]". Sorry. Please try one more time. It should work now. Copy the commands and paste them into your R. – Edward Feb 20 '20 at 11:11
  • Wow, that works! Thank you so much for your time and effort :) unbelievable!! – Félix Feb 21 '20 at 06:45