0

I have some likert data, where the scales are from 1 to 5. When I read the CSV file, R puts an X in front of the numbers, which is fine.

When I do likert(df), the graph generated has the categories with the X and I can't figure out a way to remove them.
enter image description here

ZygD
  • 22,092
  • 39
  • 79
  • 102
Nathaniel Saxe
  • 1,527
  • 2
  • 15
  • 25
  • Consider changing the column names of your df before plotting and remove the X in this step, e.g., like `colnames(df) <- gsub("X", "count", colnames(df))`. – Manuel Bickel Feb 23 '18 at 11:08

1 Answers1

0

The way I solved this was:

"name"<-`colnames<-`("data for the likert scale",c("Question", "NA", "None", "Few (1-25%)", "Some (26-50%)", "Most (51-75%)", "Almost all (76-99%)", "All (100%)"))

So the function colnames<is the key. You just put in your dataframe as the object, followed by a comma and a vector (starting with "c(...)") to name the columns accordingly.

This basically means that you rename the columns (if you have a dataframe where rows are questions and columns are likert-formatted answers) from the weird X-formatting to e.g. "Question" (col 0), "NA" (col 1), "None" (col 2) etc! Turned out fine for me:

Example of what it looks like in final form

ZygD
  • 22,092
  • 39
  • 79
  • 102