Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug fix.

  • Loading branch information...
commit b7222a0a9c1f967b433e6ea4d73e4df3982e42a3 1 parent 3c95d76
@jbryer authored
Showing with 4 additions and 8 deletions.
  1. +2 −2 R/likert.R
  2. +1 −1  R/plot.likert.bar.r
  3. +1 −5 demo/likert.R
View
4 R/likert.R
@@ -85,8 +85,8 @@ likert <- function(items, summary,
Response = rep(1:nlevels, length(unique(grouping)))
)
for(i in 1:ncol(items)) {
- #t <- as.data.frame(table(grouping, as.integer(items[,i])))
- t <- as.data.frame(table(grouping, items[,i]))
+ t <- as.data.frame(table(grouping, as.integer(items[,i])))
+ #t <- as.data.frame(table(grouping, items[,i]))
t <- cast(t, Var2 ~ grouping, value='Freq', add.missing=TRUE)
t <- apply(t, 2, FUN=function(x) { x / sum(x) * 100 } )
t <- melt(t)
View
2  R/plot.likert.bar.r
@@ -283,7 +283,7 @@ likert.bar.plot <- function(likert,
lpercentneg$pos <- lpercentneg$pos * -1
p <- p + geom_text(data=lpercentneg, aes(x=Item, y=pos,
label=paste0(round(abs(value)), '%')),
- size=text.size, color=text.colort)
+ size=text.size, color=text.color)
}
}
p <- p +
View
6 demo/likert.R
@@ -90,11 +90,6 @@ plot(l24g, type='density')
# Reordering the groups
plot(l24g, group.order=c('Canada', 'Mexico', 'United States'))
-# Reverse the levels
-l24g.reverse <- likert(items24, grouping=pisaitems$CNT, reverse.levels=TRUE)
-print(l24g.reverse)
-plot(l24g.reverse)
-
##### Item 29: How often do you read these materials because you want to?
title <- "How often do you read these materials because you want to?"
@@ -147,3 +142,4 @@ plot(lone)
loneg <- likert(items24[,1, drop=FALSE], grouping=pisaitems$CNT)
plot(loneg)
+

0 comments on commit b7222a0

Please sign in to comment.
Something went wrong with that request. Please try again.