Created
May 26, 2016 05:24
-
-
Save jonocarroll/2c84d9115478df2518f30507e482b909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## load the usual packages | |
library(magrittr) | |
library(dplyr) | |
library(ggplot2) | |
## install and load the likert package from GitHub | |
# devtools::install_github('jbryer/likert') | |
library(likert) | |
## load the data downloaded from the survey | |
surveydata <- read.csv("2016 ROpenSci #auunconf Feedback 20160524.csv", header=TRUE) | |
## rename the splitting level to something neater to display | |
surveydata %<>% rename(Category=Were.you.an.organiser..live.participant..virtual.participant..apology..or.bystander.) | |
## correct the translation of '?', "#", and ' ' into R | |
names(surveydata) <- sub(" $","?", | |
gsub("\\."," ", | |
gsub("\\.\\.how",", how", | |
gsub("\\.optional\\.","(optional)", | |
gsub("\\..auunconf"," #auunconf", | |
names(surveydata)))))) | |
## limit to the questions asked (1=Category, 2=Timestamp, 15=Name) | |
survresp <- surveydata[, -c(1,2,15)] | |
## correct the 'All items (columns) must have the same | |
## number of levels' issue by setting the levels explicitly | |
for(i in seq_along(survresp)) { | |
survresp[,i] <- factor(survresp[,i], levels=1:5) | |
} | |
## create a likert object of the survey data | |
survlik <- likert(survresp) | |
## additional packages that didn't seem to be loaded by the likert package, | |
## but which are required for plotting some features | |
library(plyr) | |
library(grid) | |
## create a detailed plot of the survey data | |
plot(survlik, group.order=names(survresp), ordered=FALSE, wrap=40, plot.percents=TRUE, include.histogram=TRUE) |
Author
jonocarroll
commented
May 26, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment