Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- winlose = read.csv("WIN_LOSE_20141119-20141125.csv",sep=",", na.string="#", header = TRUE)
- winloseLevels <- aggregate(cbind(Unique.Events.GAMEOVER,Unique.Events.WON) ~ Event.Action, data=winlose, FUN=sum)
- winloseLevels $Event.Action = as.character(winloseLevels $Event.Action)
- winloseLevels <- winloseLevels[ order(nchar(winloseLevels$Event.Action)), ]
- ratio <- (winloseLevels$Unique.Events.WON / winloseLevels$Unique.Events.GAMEOVER)
- winloseLevels <- cbind(winloseLevels, ratio)
- winloseLevels$ratio = as.numeric(winloseLevels $ratio)
- winloseLevels$ratio = round(winloseLevels$ratio, digits = 2)
- counts <- cbind(winloseLevels$Unique.Events.GAMEOVER, winloseLevels$Unique.Events.WON)
- colnames(counts) <- c("LOSE", "WIN")
- rownames(counts) <- winloseLevels$Event.Action
- pdf("graph/winloseratio.pdf")
- bplt <- barplot(t(counts), main="WIN/LOSE ratio Level",beside=T,ylab="# of unique games", col=c("red","darkblue"),legend = colnames(counts),cex.names=0.8, las=2, ylim=c(0,max(winloseLevels$Unique.Events.GAMEOVER,winloseLevels$Unique.Events.WON)+10))
- ypos <- apply(counts, 1, max)
- text(y= ypos+1, x= colMeans(bplt), labels=winloseLevels$ratio)
- dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement