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