Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. #!/usr/bin/env Rscript
  2. # author: John Lekberg
  3. # date: 2016-02-10
  4. #
  5. # This is for part 9 of assignment 2.
  6. # It deals with analysis of my data set.
  7. #
  8. # Copyright (c) 2016 John Lekberg
  9. #
  10. # Permission is hereby granted, free of charge, to any person obtaining a copy of
  11. # this software and associated documentation files (the "Software"), to deal in
  12. # the Software without restriction, including without limitation the rights to
  13. # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  14. # of the Software, and to permit persons to whom the Software is furnished to do
  15. # so, subject to the following conditions:
  16. #
  17. # The above copyright notice and this permission notice shall be included in all
  18. # copies or substantial portions of the Software.
  19. #
  20. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  23. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  24. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  25. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  26. # SOFTWARE.
  27. gg <- read.csv("GameGrumpsData.csv")
  28.  
  29. # Coerces `publishedAt` to a string, so dates can be compared.
  30. # The dates used are in ISO 8601 format, so they can safely be
  31. # compared lexicographically.
  32. gg$publishedAt <- as.character(gg$publishedAt)
  33.  
  34. # Produce the dummy variable to determine who was hosting the show
  35. gg$era <- as.factor(ifelse(gg$publishedAt < "2013-06-20", "Jon", "Dan"))
  36.  
  37. # Get rid of all data newer than three months before 2016-01-24.
  38. # This is because very new videos are less likely to have as many views,
  39. # comments, likes and dislikes.
  40. gg <- gg[gg$publishedAt < "2015-10-24", ]
  41.  
  42. # Only keep "Game Grumps" videos, not spin off series like "Steam Train"
  43. # or "GrumpCade", etc.
  44. gg <- gg[grepl("Game Grumps", gg$title),]
  45.  
  46. ##################################
  47. # Comparing Jon-Era and Dan-Era. #
  48. ##################################
  49.  
  50. t.test(gg$likeCount ~ gg$era)
  51. t.test(gg$dislikeCount ~ gg$era)
  52. t.test(gg$commentCount ~ gg$era)
  53. t.test(gg$viewCount ~ gg$era)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement