diff --git a/DESCRIPTION b/DESCRIPTION
index c222851..7b5c4b4 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -4,7 +4,7 @@ Description: Datasets and code published by the data journalism website
'FiveThirtyEight' available at .
Note that while we received guidance from editors at 'FiveThirtyEight', this
package is not officially published by 'FiveThirtyEight'.
-Version: 0.3.0.9000
+Version: 0.4.0
Authors@R: c(
person("Albert Y.", "Kim", email = "albert.ys.kim@gmail.com", role = c("aut", "cre")),
person("Chester", "Ismay", email = "chester.ismay@gmail.com", role = "aut"),
diff --git a/NEWS.md b/NEWS.md
index c36ca12..dec7f40 100755
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,7 @@
-# fivethirtyeight 0.3.0.9000
+# fivethirtyeight 0.4.0
-* Added new and missing data sets:
+* Package website now at
+* Added new data sets:
+ By Meredith Manley: `ahca_polls`, `bachelorette`, `candy_rankings`,
`chess_transfers`, `generic_polllist`, `generic_topline`, `mlb_elo`,
`ratings`, `spi_global_rankings`, `spi_matches`, `tweets`
@@ -10,9 +11,20 @@
`tv_hurricanes`, `tv_hurricanes_by_network`, `tv_states`, `sandy_311`,
`senators`, `trump_approval_poll`, `trump_approval_trend`,
`trumpworld_issues`, `trumpworld_polls`, `twitter_presidents`, `undefeated`
-* Package website now at
+* Note for now `mayweather_mcgregor_tweets`, `mlb_elo`, `nba_carmelo`,
+`nfl_elo`, `senators`, only include the first 10 rows of the data because of R
+package file size restrictions (< 5MB tarballs); code to download/process the
+entire dataset are included in help files. We hope to include full versions of
+these datasets in v0.5.0 of package using the `drat` package.
* Converted all ordinal categorical variables to `factor(..., ordered = TRUE)`.
Ex: `bechdel$clean_test`
+* Vignette notes:
+ + Added a vignette that has a link to all user-contributed vignettes, which
+ areonly available on development version of package and on GitHub due to
+ CRAN package size restrictions.
+ + For all datasets that have a user contributed vignette, add a link to it
+ in the corresponding help/roxygen code file.
+* Added `CITATION`
# fivethirtyeight 0.3.0
diff --git a/R/data_albert.R b/R/data_albert.R
index b05d3b4..9bd6118 100755
--- a/R/data_albert.R
+++ b/R/data_albert.R
@@ -139,7 +139,7 @@
#' \item{wine_servings}{Servings of wine in average serving sizes per person}
#' \item{total_litres_of_pure_alcohol}{Total litres of pure alcohol per person}
#' }
-#' @source World Health Organisation, Global Information System on Alcohol and Health (GISAH), 2010.
+#' @source World Health Organization, Global Information System on Alcohol and Health (GISAH), 2010.
#' @examples
#' # To convert data frame to tidy data (long) format, run:
#' library(tidyverse)
@@ -159,6 +159,8 @@
#' The raw data behind the story
#' "'Straight Outta Compton' Is The Rare Biopic Not About White Dudes"
#' \url{https://fivethirtyeight.com/features/straight-outta-compton-is-the-rare-biopic-not-about-white-dudes/}.
+#' An analysis using this data was contributed by Pradeep Adhokshaja as a package vignette at
+#' \url{http://fivethirtyeight-r.netlify.com/articles/biopics.html}.
#'
#' @format A data frame with 761 rows representing movies and 14 variables:
#' \describe{
@@ -187,6 +189,8 @@
#' The raw data behind the story
#' "A Statistical Analysis of the Work of Bob Ross"
#' \url{https://fivethirtyeight.com/features/a-statistical-analysis-of-the-work-of-bob-ross/}.
+#' An analysis using this data was contributed by Jonathan Bouchet as a package vignette at
+#' \url{http://fivethirtyeight-r.netlify.com/articles/bob_ross.html}.
#'
#' @format A data frame with 403 rows representing episodes and 71 variables:
#' \describe{
@@ -335,7 +339,7 @@
#' \item{employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
#' \item{unemployed}{Number unemployed (ESR == 3)}
#' \item{unemployment_rate}{Unemployed / (Unemployed + Employed)}
-#' \item{p25th}{25th percentile of earnigns}
+#' \item{p25th}{25th percentile of earnings}
#' \item{median}{Median earnings of full-time, year-round workers}
#' \item{p75th}{75th percentile of earnings}
#' }
@@ -362,7 +366,7 @@
#' \item{grad_employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
#' \item{grad_unemployed}{Number unemployed (ESR == 3)}
#' \item{grad_unemployment_rate}{Unemployed / (Unemployed + Employed)}
-#' \item{grad_p25th}{25th percentile of earnigns}
+#' \item{grad_p25th}{25th percentile of earnings}
#' \item{grad_median}{Median earnings of full-time, year-round workers}
#' \item{grad_p75th}{75th percentile of earnings}
#' \item{nongrad_total}{Total number of people with major}
@@ -370,7 +374,7 @@
#' \item{nongrad_employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
#' \item{nongrad_unemployed}{Number unemployed (ESR == 3)}
#' \item{nongrad_unemployment_rate}{Unemployed / (Unemployed + Employed)}
-#' \item{nongrad_p25th}{25th percentile of earnigns}
+#' \item{nongrad_p25th}{25th percentile of earnings}
#' \item{nongrad_median}{Median earnings of full-time, year-round workers}
#' \item{nongrad_p75th}{75th percentile of earnings}
#' \item{grad_share}{grad_total / (grad_total + nongrad_total)}
@@ -405,7 +409,7 @@
#' \item{employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
#' \item{unemployed}{Number unemployed (ESR == 3)}
#' \item{unemployment_rate}{Unemployed / (Unemployed + Employed)}
-#' \item{p25th}{25th percentile of earnigns}
+#' \item{p25th}{25th percentile of earnings}
#' \item{median}{Median earnings of full-time, year-round workers}
#' \item{p75th}{75th percentile of earnings}
#' \item{college_jobs}{Number with job requiring a college degree}
@@ -424,6 +428,8 @@
#' The raw data behind the story
#' "Comic Books Are Still Made By Men, For Men And About Men"
#' \url{https://fivethirtyeight.com/features/women-in-comic-books/}.
+#' An analysis using this data was contributed by Jonathan Bouchet as a package vignette at
+#' \url{http://fivethirtyeight-r.netlify.com/articles/comics_gender.html}.
#'
#' @format A data frame with 23272 rows representing characters and 16 variables:
#' \describe{
@@ -476,7 +482,7 @@
#' \item{care_data}{How much, if at all, do you care about the debate over the use of the word "data" as a singular or plural noun?}
#' \item{care_proper_grammar}{In your opinion, how important or unimportant is proper use of grammar?}
#' }
-#' @source See \url{https://github.com/fivethirtyeight/data/tree/master/comma-survey-data}.
+#' @source See \url{https://github.com/fivethirtyeight/data/tree/master/comma-survey}.
"comma_survey"
@@ -537,9 +543,9 @@
#' \item{google_knowledge_occupation}{Their occupation or office, according to Google's Knowledge Graph or, if they're not in there, how Stewart introduced them on the program.}
#' \item{show}{Air date of episode. Not unique, as some shows had more than one guest}
#' \item{group}{A larger group designation for the occupation. For instance, us senators, us presidents, and former presidents are all under "politicians"}
-#' \item{raw_guest_list}{The person or list of people who appeared on the show, according to Wikipedia. The GoogleKnowlege_Occupation only refers to one of them in a given row.}
+#' \item{raw_guest_list}{The person or list of people who appeared on the show, according to Wikipedia. The GoogleKnowledge_Occupation only refers to one of them in a given row.}
#' }
-#' @source Google Knowlege Graph, The Daily Show clip library, Wikipedia.
+#' @source Google Knowledge Graph, The Daily Show clip library, Wikipedia.
"daily_show_guests"
diff --git a/R/data_chester.R b/R/data_chester.R
index ed364f6..0e53391 100644
--- a/R/data_chester.R
+++ b/R/data_chester.R
@@ -196,7 +196,7 @@
#' \item{gamenum}{Order of All-Star Game for the season (in years w/ multiple ASGs; set to 0 when only 1 per year)}
#' \item{gameid}{Game ID at Baseball-Reference.com}
#' \item{lgid}{League of All-Star team}
-#' \item{startingpos}{Postion (according to baseball convention; 1=pitcher, 2=catcher, etc.) if starter}
+#' \item{startingpos}{Position (according to baseball convention; 1=pitcher, 2=catcher, etc.) if starter}
#' \item{off600}{Estimate of offensive talent, in runs above league average per 600 plate appearances}
#' \item{def600}{Estimate of fielding talent, in runs above league average per 600 plate appearances}
#' \item{pitch200}{Estimate of pitching talent, in runs above league average per 200 innings pitched}
@@ -257,6 +257,8 @@
#' The raw data behind the story
#' "Projecting The Top 50 Players In The 2015 NBA Draft Class"
#' \url{https://fivethirtyeight.com/features/projecting-the-top-50-players-in-the-2015-nba-draft-class/}.
+#' An analysis using this data was contributed by G. Elliott Morris as a package vignette at
+#' \url{http://fivethirtyeight-r.netlify.com/articles/nba.html}.
#'
#' @format A data frame with 1090 rows representing National Basketball Association players/prospects and 9 variables:
#' \describe{
@@ -333,7 +335,7 @@
#' \item{name}{first initial.last name}
#' \item{team}{team at time of suspension}
#' \item{games}{number of games suspended (one regular season = 16 games)}
-#' \item{category}{personal conduct, substance abuse, peformance enhancing drugs or in-game violence}
+#' \item{category}{personal conduct, substance abuse, performance enhancing drugs or in-game violence}
#' \item{description}{description of suspension}
#' \item{year}{year of suspension}
#' \item{source}{news source}
diff --git a/R/data_jen.R b/R/data_jen.R
index 94381a7..6568a02 100644
--- a/R/data_jen.R
+++ b/R/data_jen.R
@@ -215,6 +215,9 @@
#' The raw data behind the story
#' "A Complete Catalog Of Every Time Someone Cursed Or Bled Out In A Quentin Tarantino Movie"
#' \url{https://fivethirtyeight.com/features/complete-catalog-curses-deaths-quentin-tarantino-films/}.
+#' An analysis using this data was contributed by Olivia Barrows, Jojo Miller, and Jayla Nakayama
+#' as a package vignette at
+#' \url{http://fivethirtyeight-r.netlify.com/articles/tarantino_swears.html}.
#'
#' @format A data frame with 1894 rows representing curse/death instances and 4 variables:
#' \describe{
@@ -303,7 +306,9 @@
#' The raw data behind the story
#' "The World's Favorite Donald Trump Tweets"
#' \url{https://fivethirtyeight.com/features/the-worlds-favorite-donald-trump-tweets/}.
-#' Tweets posted on twitter by Donald Trump (@@realDonaldTrump)
+#' Tweets posted on twitter by Donald Trump (@@realDonaldTrump).
+#' An analysis using this data was contributed by Adam Spannbauer as a package vignette at
+#' \url{http://fivethirtyeight-r.netlify.com/articles/trump_twitter.html}.
#'
#' @format A data frame with 448 rows representing tweets and 3 variables:
#' \describe{
@@ -461,7 +466,7 @@
#' \item{mehs}{Mehs}
#' \item{league_average_gpct}{League-average goose percentage}
#' \item{ppf}{Pitcher park factor}
-#' \item{replacement_gpct}{Replacement-level goose pecentage}
+#' \item{replacement_gpct}{Replacement-level goose percentage}
#' \item{gwar}{Goose Wins Above Replacement}
#' \item{key_retro}{Retrosheet unique player identifier}
#' }
diff --git a/R/data_maggie.R b/R/data_maggie.R
index 53541d2..6a1d533 100644
--- a/R/data_maggie.R
+++ b/R/data_maggie.R
@@ -58,7 +58,10 @@
#' And our "2017 NFL Predictions"
#' \url{https://projects.fivethirtyeight.com/2017-nfl-predictions/}
#'
-#' @format a data frame with 16,007 rows representing games and 14 variables:
+#' @format Because of R package size restrictions, only a preview of the
+#' first 10 rows of this dataset is included; to obtain the entire dataset
+#' (1920 to 2018 games) see Examples below. A data frame with 10 rows
+#' representing games and 14 variables:
#' \describe{
#' \item{date}{Date}
#' \item{season}{Season year, 1920-2018}
@@ -76,6 +79,15 @@
#' \item{score2}{Points scored by Team 2}
#' }
#' @source See \url{https://projects.fivethirtyeight.com/nfl-api/nfl_elo.csv}
+#' # To obtain the entire dataset, run the following code:
+#' library(tidyverse)
+#' library(janitor)
+#' nfl_elo <- read_csv("https://projects.fivethirtyeight.com/nfl-api/nfl_elo.csv") %>%
+#' clean_names() %>%
+#' mutate(
+#' team1 = as.factor(team1),
+#' team2 = as.factor(team2),
+#' neutral = ifelse(neutral == 1, TRUE, FALSE))
"nfl_elo"
@@ -118,29 +130,29 @@
#' \describe{
#' \item{team}{NFL team}
#' \item{total_respondents}{Total number of poll respondents who ranked the given team in their top 3 favorites}
-#' \item{asian_dem}{Number of asian, democrat poll respondents who ranked the given team in their top 3 favorites}
-#' \item{black_dem}{Number of black, democrat poll respondents who ranked the given team in their top 3 favorites}
-#' \item{hispanic_dem}{Number of hispanic, democrat poll respondents who ranked the given team in their top 3 favorites}
-#' \item{other_dem}{Number of democrat poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites}
-#' \item{white_dem}{Number of white, democrat poll respondents who ranked the given team in their top 3 favorites}
+#' \item{asian_dem}{Number of Asian, democrat poll respondents who ranked the given team in their top 3 favorites}
+#' \item{black_dem}{Number of Black, democrat poll respondents who ranked the given team in their top 3 favorites}
+#' \item{hispanic_dem}{Number of Hispanic, democrat poll respondents who ranked the given team in their top 3 favorites}
+#' \item{other_dem}{Number of democrat poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites}
+#' \item{white_dem}{Number of White, democrat poll respondents who ranked the given team in their top 3 favorites}
#' \item{total_dem}{Total number of democrat poll respondents who ranked the given team in their top 3 favorites}
-#' \item{asian_ind}{Number of asian, independent poll respondents who ranked the given team in their top 3 favorites}
-#' \item{black_ind}{Number of black, independent poll respondents who ranked the given team in their top 3 favorites}
-#' \item{hispanic_ind}{Number of hispanic, independent poll respondents who ranked the given team in their top 3 favorites}
-#' \item{other_ind}{Number of independent poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites}
-#' \item{white_ind}{Number of white, independent poll respondents who ranked the given team in their top 3 favorites}
+#' \item{asian_ind}{Number of Asian, independent poll respondents who ranked the given team in their top 3 favorites}
+#' \item{black_ind}{Number of Black, independent poll respondents who ranked the given team in their top 3 favorites}
+#' \item{hispanic_ind}{Number of Hispanic, independent poll respondents who ranked the given team in their top 3 favorites}
+#' \item{other_ind}{Number of independent poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites}
+#' \item{white_ind}{Number of White, independent poll respondents who ranked the given team in their top 3 favorites}
#' \item{total_ind}{Total number of independent poll respondents who ranked the given team in their top 3 favorites}
-#' \item{asian_gop}{Number of asian, republican poll respondents who ranked the given team in their top 3 favorites}
-#' \item{black_gop}{Number of black, republican poll respondents who ranked the given team in their top 3 favorites}
-#' \item{hispanic_gop}{Number of hispanic, republican poll respondents who ranked the given team in their top 3 favorites}
-#' \item{other_gop}{Number of republican poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites}
-#' \item{white_gop}{Number of white, republican poll respondents who ranked the given team in their top 3 favorites}
+#' \item{asian_gop}{Number of Asian, republican poll respondents who ranked the given team in their top 3 favorites}
+#' \item{black_gop}{Number of Black, republican poll respondents who ranked the given team in their top 3 favorites}
+#' \item{hispanic_gop}{Number of Hispanic, republican poll respondents who ranked the given team in their top 3 favorites}
+#' \item{other_gop}{Number of republican poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites}
+#' \item{white_gop}{Number of White, republican poll respondents who ranked the given team in their top 3 favorites}
#' \item{total_gop}{Total number of republican poll respondents who ranked the given team in their top 3 favorites}
#' \item{gop_percent}{Percent of fans (who ranked the team in their top 3 favorite NFL teams) who are republicans}
#' \item{dem_percent}{Percent of fans who are democrats}
#' \item{ind_percent}{Percent of fans who are independent}
-#' \item{white_percent}{Percent of fans who are white}
-#' \item{nonwhite_percent}{Percent of fans who are not white}
+#' \item{white_percent}{Percent of fans who are White}
+#' \item{nonwhite_percent}{Percent of fans who are not White}
#' }
#' @source See \url{https://github.com/fivethirtyeight/data/tree/master/nfl-fandom/NFL_fandom_data-surveymonkey.csv}
#' @examples
@@ -421,8 +433,8 @@
#' \item{weight}{The weight fivethirtyeight gives the poll when determining approval ratings based on historical accuracy of the pollster}
#' \item{approve}{The percentage of respondents who approve of the president}
#' \item{disapprove}{The percentage of respondents who disapprove of the president}
-#' \item{adjusted_approve}{The percentage of respondets who approve of the president adjusted for systematic tendencies of the polling firm}
-#' \item{adjusted_disapprove}{The percentage of respondets who approve of the president adjusted for systematic tendencies of the polling firm}
+#' \item{adjusted_approve}{The percentage of respondents who approve of the president adjusted for systematic tendencies of the polling firm}
+#' \item{adjusted_disapprove}{The percentage of respondents who approve of the president adjusted for systematic tendencies of the polling firm}
#' \item{multiversions}{True if there are multiple versions of the poll, False if there are not}
#' \item{tracking}{TRUE if the poll was tracked, FALSE if not}
#' \item{url}{Poll result URL}
@@ -499,7 +511,7 @@
#' \url{https://fivethirtyeight.com/features/what-the-world-thinks-of-trump/}:
#' Trump World Polls Dataset.
#'
-#' @format A data frame with 32 rows representng years and 40 variables:
+#' @format A data frame with 32 rows representing years and 40 variables:
#' \describe{
#' \item{year}{Year the poll was conducted}
#' \item{avg}{The average percentage people who answered the poll question positively (support the president or have a favorable view of the U.S.)}
@@ -522,7 +534,7 @@
#' \item{philippines}{The percentage of people from the Philippines who answered the poll question positively}
#' \item{south_korea}{The percentage of people from South Korea who answered the poll question positively}
#' \item{vietnam}{The percentage of people from Vietnam who answered the poll question positively}
-#' \item{israel}{The percentage of people from Isreal who answered the poll question positively}
+#' \item{israel}{The percentage of people from Israel who answered the poll question positively}
#' \item{jordan}{The percentage of people from Jordan who answered the poll question positively}
#' \item{lebanon}{The percentage of people from Lebanon who answered the poll question positively}
#' \item{tunisia}{The percentage of people from Tunisia who answered the poll question positively}
@@ -540,7 +552,7 @@
#' \item{mexico}{The percentage of people from Mexico who answered the poll question positively}
#' \item{peru}{The percentage of people from Peru who answered the poll question positively}
#' \item{venezuela}{The percentage of people from Venezuela who answered the poll question positively}
-#' \item{question}{The item being polled. Specificially, whether respondents: 1) Have a favorable view of the U.S. or 2) Trust the U.S. President when it comes to foreign affairs}
+#' \item{question}{The item being polled. Specifically, whether respondents: 1) Have a favorable view of the U.S. or 2) Trust the U.S. President when it comes to foreign affairs}
#' }
#' @source Pew Research Center \url{http://www.pewresearch.org/fact-tank/2017/07/17/9-charts-on-how-the-world-sees-trump/}
#' @examples
diff --git a/R/data_meredith.R b/R/data_meredith.R
index 9e3f3a9..04a6f0c 100644
--- a/R/data_meredith.R
+++ b/R/data_meredith.R
@@ -10,7 +10,7 @@
#' \item{end}{End date of the poll.}
#' \item{pollster}{The entity that conducts and collects information from the poll.}
#' \item{favor}{The number of affirmative responses to the question at the pollster.}
-#' \item{oppose}{The number of negative reponses to the question at the pollster.}
+#' \item{oppose}{The number of negative responses to the question at the pollster.}
#' \item{url}{The website associated with the polling question.}
#' \item{text}{The polling question asked at the pollster.}
#' }
@@ -28,9 +28,9 @@
#' Bachelorette / Bachelor
#'
#' The raw data behind the stories:
-#' "How To Spot A Front-Runner On The ‘Bachelor’ Or ‘Bachelorette’"
-#' \url{https://fivethirtyeight.com/features/the-bachelorette/}, "Rachel’s Season Is Fitting Neatly Into ‘Bachelorette’ History"
-#' \url{https://fivethirtyeight.com/features/rachels-season-is-fitting-neatly-into-bachelorette-history/}, and "Rachel Lindsay’s ‘Bachelorette’ Season, In Three Charts"
+#' "How To Spot A Front-Runner On The 'Bachelor' Or 'Bachelorette'"
+#' \url{https://fivethirtyeight.com/features/the-bachelorette/}, "Rachel's Season Is Fitting Neatly Into 'Bachelorette' History"
+#' \url{https://fivethirtyeight.com/features/rachels-season-is-fitting-neatly-into-bachelorette-history/}, and "Rachel Lindsay's 'Bachelorette' Season, In Three Charts"
#' \url{https://fivethirtyeight.com/features/rachel-lindsays-bachelorette-season-in-three-charts/}.
#'
#' @format A data frame with 887 rows representing the Bachelorette and Bachelor contestants and 23 variables:
@@ -60,14 +60,14 @@
#' \item{dates_10}{Who was on which date in week 10.}
#' }
#' @details Eliminates connote either an elimination (starts with "E") or a rose
-#' (starts with "R"). Eliminations supercede roses. "E" connotes a standard
+#' (starts with "R"). Eliminations supersede roses. "E" connotes a standard
#' elimination, typically at a rose ceremony. "EQ" means the contestant quits.
#' "EF" means the contestant was fired by production. "ED" connotes a date
#' elimination. "EU" connotes an unscheduled elimination, one that takes place
#' at a time outside of a date or rose ceremony. "R" means the contestant
#' received a rose. "R1" means the contestant got a first impression rose.
#' "D1" means a one-on-one date, "D2" means a 2-on-1, "D3" means a 3-on-1
-#' group date, and so on. Weeks of the show are deliminated by rose
+#' group date, and so on. Weeks of the show are eliminated by rose
#' ceremonies, and may not line up exactly with episodes.
#' @source \url{http://bachelor-nation.wikia.com/wiki/Bachelor_Nation_Wikia}
#' and then missing seasons were filled in by ABC and FiveThirtyEight staffers.
@@ -117,9 +117,9 @@
#' @format A data frame with 932 rows representing international player transfers and 5 variables:
#' \describe{
#' \item{url}{The corresponding website on the World Chess Federation page which details the transfers of a given year.}
-#' \item{id}{An numeric identifier for the chess player who transfered.}
+#' \item{id}{An numeric identifier for the chess player who transferred.}
#' \item{federation}{The current national federation of the chess player}
-#' \item{form_fed}{The national federation from which the chress player has transfered.}
+#' \item{form_fed}{The national federation from which the chess player has transferred.}
#' \item{transfer_date}{The date at which the transfer took place.}
#' }
#' @source World Chess Federation
@@ -191,7 +191,7 @@
#' An Inconvenient Sequel
#'
#' The raw data behind the story
-#' "Al Gore’s New Movie Exposes The Big Flaw In Online Movie Ratings"
+#' "Al Gore's New Movie Exposes The Big Flaw In Online Movie Ratings"
#' \url{https://fivethirtyeight.com/features/al-gores-new-movie-exposes-the-big-flaw-in-online-movie-ratings/}.
#'
#' @format A data frame with 80053 rows representing movie ratings and 27 variables:
@@ -243,7 +243,9 @@
#' "The Mayweather-McGregor Fight As Told Through Emojis"
#' \url{https://fivethirtyeight.com/?post_type=fte_features&p=161615}.
#'
-#' @format A data frame with 12118 rows representing tweets and 7 variables:
+#' @format Because of R package size restrictions, only a preview of the
+#' first 10 rows of this dataset is included; to obtain the entire dataset
+#' (12118 rows) see Examples below. A data frame with 10 rows representing tweets and 7 variables:
#' \describe{
#' \item{created_at}{Time and date at which the tweet associated with the Mayweather vs. McGregor fight was sent.}
#' \item{emojis}{Whether or not emojis were used in the tweet about the fight.}
@@ -258,6 +260,19 @@
#' #MayweatherVMcGregor, #MayweatherVsMcGregor, #McGregor and #Mayweather.
#' Data was collected on August 27, 2017 between 12:05 a.m. and 1:15 a.m. EDT
#' using the Twitter streaming API. \url{https://github.com/fivethirtyeight/data/tree/master/mayweather-mcgregor}
+#' @examples
+#' # To obtain the entire dataset, run the code inside the following if statement:
+#' if(FALSE){
+#' library(tidyverse)
+#' url <-
+#' "https://raw.githubusercontent.com/fivethirtyeight/data/master/mayweather-mcgregor/tweets.csv"
+#' mayweather_mcgregor_tweets <- read_csv(url) %>%
+#' mutate(
+#' emojis = as.logical(emojis),
+#' retweeted = as.logical(retweeted),
+#' id = as.character(id)
+#' )
+#' }
"mayweather_mcgregor_tweets"
diff --git a/data/mayweather_mcgregor_tweets.rda b/data/mayweather_mcgregor_tweets.rda
index c772956..91b8ac2 100644
Binary files a/data/mayweather_mcgregor_tweets.rda and b/data/mayweather_mcgregor_tweets.rda differ
diff --git a/data/mlb_elo.rda b/data/mlb_elo.rda
index c644602..b118bac 100644
Binary files a/data/mlb_elo.rda and b/data/mlb_elo.rda differ
diff --git a/data/nfl_elo.rda b/data/nfl_elo.rda
index aca2bdf..5823c07 100644
Binary files a/data/nfl_elo.rda and b/data/nfl_elo.rda differ
diff --git a/docs/LICENSE.html b/docs/LICENSE.html
index 9904f03..d1b24db 100644
--- a/docs/LICENSE.html
+++ b/docs/LICENSE.html
@@ -91,6 +91,9 @@
## # A tibble: 6 x 4
## # Groups: draft_year [2]
-## player position draft_year projected_spm
-## <chr> <chr> <int> <dbl>
-## 1 Andre Iguodala SG 2004 0.7235079
-## 2 Luol Deng SF 2004 0.4021089
-## 3 Emeka Okafor PF 2004 0.3828638
-## 4 Dwyane Wade SG 2003 0.7387024
-## 5 Chris Kaman C 2003 0.4069592
-## 6 Carmelo Anthony SF 2003 0.3640098
+## player position draft_year projected_spm
+## <chr> <chr> <int> <dbl>
+## 1 Andre Iguodala SG 2004 0.724
+## 2 Luol Deng SF 2004 0.402
+## 3 Emeka Okafor PF 2004 0.383
+## 4 Dwyane Wade SG 2003 0.739
+## 5 Chris Kaman C 2003 0.407
+## 6 Carmelo Anthony SF 2003 0.364
If you are familiar with NBA basketball, these names will stick out to you. Dwayne Wade and Carmelo Anthony are perennial all-stars and Andre Iguodala was the 2015 NBA Finals MVP. (Note that LeBron James is not in this data.)
The surprising thing here is that these great players were not able to counter-balance the players with low projected_spm. Remember that the mean was used here so even if the great players were outliers (in the positive direction) they weren’t able to pull the mean in their direction. Also note that not all of the players listed in this data set ended up playing in the NBA or, if they did, potentially only played a small amount of time.
mutate(n=round(n,2)) %>%hchart("treemap", hcaes(x = type_of_subject, value = n, color = n)) %>%hc_title(text="Type of Subjects of Movies involving White Actors(%)")
-
-
Actors of Color
+
+
Actors of Color
biopics %>%mutate(person_of_color=ifelse(person_of_color==0,"White","Person of Color")) %>%group_by(person_of_color,type_of_subject) %>%
@@ -200,8 +203,8 @@
mutate(n=round(n,2)) %>%hchart("treemap", hcaes(x = type_of_subject, value = n, color = n)) %>%hc_title(text="Type of Subjects of Movies involving Actors of Color(%)")
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-10-1.png
index 96c8b2c..bc0ea98 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-10-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-10-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-11-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-11-1.png
index 0683a40..955b279 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-11-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-11-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-12-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-12-1.png
index 666e20a..f71595d 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-12-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-12-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-13-1.png
index 0d9a34a..abfbecf 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-13-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-13-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-4-1.png
index 1d7fd68..44e23ea 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-4-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-7-1.png
index 55d70c2..05f59a9 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-7-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-8-1.png
index adee5fb..c7f38fb 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-8-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-8-1.png differ
diff --git a/docs/articles/biopics_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/biopics_files/figure-html/unnamed-chunk-9-1.png
index 104ee50..b7d1b8f 100644
Binary files a/docs/articles/biopics_files/figure-html/unnamed-chunk-9-1.png and b/docs/articles/biopics_files/figure-html/unnamed-chunk-9-1.png differ
diff --git a/docs/articles/biopics_files/htmlwidgets-1.0/htmlwidgets.js b/docs/articles/biopics_files/htmlwidgets-1.0/htmlwidgets.js
new file mode 100644
index 0000000..ecda3ef
--- /dev/null
+++ b/docs/articles/biopics_files/htmlwidgets-1.0/htmlwidgets.js
@@ -0,0 +1,836 @@
+(function() {
+ // If window.HTMLWidgets is already defined, then use it; otherwise create a
+ // new object. This allows preceding code to set options that affect the
+ // initialization process (though none currently exist).
+ window.HTMLWidgets = window.HTMLWidgets || {};
+
+ // See if we're running in a viewer pane. If not, we're in a web browser.
+ var viewerMode = window.HTMLWidgets.viewerMode =
+ /\bviewer_pane=1\b/.test(window.location);
+
+ // See if we're running in Shiny mode. If not, it's a static document.
+ // Note that static widgets can appear in both Shiny and static modes, but
+ // obviously, Shiny widgets can only appear in Shiny apps/documents.
+ var shinyMode = window.HTMLWidgets.shinyMode =
+ typeof(window.Shiny) !== "undefined" && !!window.Shiny.outputBindings;
+
+ // We can't count on jQuery being available, so we implement our own
+ // version if necessary.
+ function querySelectorAll(scope, selector) {
+ if (typeof(jQuery) !== "undefined" && scope instanceof jQuery) {
+ return scope.find(selector);
+ }
+ if (scope.querySelectorAll) {
+ return scope.querySelectorAll(selector);
+ }
+ }
+
+ function asArray(value) {
+ if (value === null)
+ return [];
+ if ($.isArray(value))
+ return value;
+ return [value];
+ }
+
+ // Implement jQuery's extend
+ function extend(target /*, ... */) {
+ if (arguments.length == 1) {
+ return target;
+ }
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i];
+ for (var prop in source) {
+ if (source.hasOwnProperty(prop)) {
+ target[prop] = source[prop];
+ }
+ }
+ }
+ return target;
+ }
+
+ // IE8 doesn't support Array.forEach.
+ function forEach(values, callback, thisArg) {
+ if (values.forEach) {
+ values.forEach(callback, thisArg);
+ } else {
+ for (var i = 0; i < values.length; i++) {
+ callback.call(thisArg, values[i], i, values);
+ }
+ }
+ }
+
+ // Replaces the specified method with the return value of funcSource.
+ //
+ // Note that funcSource should not BE the new method, it should be a function
+ // that RETURNS the new method. funcSource receives a single argument that is
+ // the overridden method, it can be called from the new method. The overridden
+ // method can be called like a regular function, it has the target permanently
+ // bound to it so "this" will work correctly.
+ function overrideMethod(target, methodName, funcSource) {
+ var superFunc = target[methodName] || function() {};
+ var superFuncBound = function() {
+ return superFunc.apply(target, arguments);
+ };
+ target[methodName] = funcSource(superFuncBound);
+ }
+
+ // Add a method to delegator that, when invoked, calls
+ // delegatee.methodName. If there is no such method on
+ // the delegatee, but there was one on delegator before
+ // delegateMethod was called, then the original version
+ // is invoked instead.
+ // For example:
+ //
+ // var a = {
+ // method1: function() { console.log('a1'); }
+ // method2: function() { console.log('a2'); }
+ // };
+ // var b = {
+ // method1: function() { console.log('b1'); }
+ // };
+ // delegateMethod(a, b, "method1");
+ // delegateMethod(a, b, "method2");
+ // a.method1();
+ // a.method2();
+ //
+ // The output would be "b1", "a2".
+ function delegateMethod(delegator, delegatee, methodName) {
+ var inherited = delegator[methodName];
+ delegator[methodName] = function() {
+ var target = delegatee;
+ var method = delegatee[methodName];
+
+ // The method doesn't exist on the delegatee. Instead,
+ // call the method on the delegator, if it exists.
+ if (!method) {
+ target = delegator;
+ method = inherited;
+ }
+
+ if (method) {
+ return method.apply(target, arguments);
+ }
+ };
+ }
+
+ // Implement a vague facsimilie of jQuery's data method
+ function elementData(el, name, value) {
+ if (arguments.length == 2) {
+ return el["htmlwidget_data_" + name];
+ } else if (arguments.length == 3) {
+ el["htmlwidget_data_" + name] = value;
+ return el;
+ } else {
+ throw new Error("Wrong number of arguments for elementData: " +
+ arguments.length);
+ }
+ }
+
+ // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
+ function escapeRegExp(str) {
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+ }
+
+ function hasClass(el, className) {
+ var re = new RegExp("\\b" + escapeRegExp(className) + "\\b");
+ return re.test(el.className);
+ }
+
+ // elements - array (or array-like object) of HTML elements
+ // className - class name to test for
+ // include - if true, only return elements with given className;
+ // if false, only return elements *without* given className
+ function filterByClass(elements, className, include) {
+ var results = [];
+ for (var i = 0; i < elements.length; i++) {
+ if (hasClass(elements[i], className) == include)
+ results.push(elements[i]);
+ }
+ return results;
+ }
+
+ function on(obj, eventName, func) {
+ if (obj.addEventListener) {
+ obj.addEventListener(eventName, func, false);
+ } else if (obj.attachEvent) {
+ obj.attachEvent(eventName, func);
+ }
+ }
+
+ function off(obj, eventName, func) {
+ if (obj.removeEventListener)
+ obj.removeEventListener(eventName, func, false);
+ else if (obj.detachEvent) {
+ obj.detachEvent(eventName, func);
+ }
+ }
+
+ // Translate array of values to top/right/bottom/left, as usual with
+ // the "padding" CSS property
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/padding
+ function unpackPadding(value) {
+ if (typeof(value) === "number")
+ value = [value];
+ if (value.length === 1) {
+ return {top: value[0], right: value[0], bottom: value[0], left: value[0]};
+ }
+ if (value.length === 2) {
+ return {top: value[0], right: value[1], bottom: value[0], left: value[1]};
+ }
+ if (value.length === 3) {
+ return {top: value[0], right: value[1], bottom: value[2], left: value[1]};
+ }
+ if (value.length === 4) {
+ return {top: value[0], right: value[1], bottom: value[2], left: value[3]};
+ }
+ }
+
+ // Convert an unpacked padding object to a CSS value
+ function paddingToCss(paddingObj) {
+ return paddingObj.top + "px " + paddingObj.right + "px " + paddingObj.bottom + "px " + paddingObj.left + "px";
+ }
+
+ // Makes a number suitable for CSS
+ function px(x) {
+ if (typeof(x) === "number")
+ return x + "px";
+ else
+ return x;
+ }
+
+ // Retrieves runtime widget sizing information for an element.
+ // The return value is either null, or an object with fill, padding,
+ // defaultWidth, defaultHeight fields.
+ function sizingPolicy(el) {
+ var sizingEl = document.querySelector("script[data-for='" + el.id + "'][type='application/htmlwidget-sizing']");
+ if (!sizingEl)
+ return null;
+ var sp = JSON.parse(sizingEl.textContent || sizingEl.text || "{}");
+ if (viewerMode) {
+ return sp.viewer;
+ } else {
+ return sp.browser;
+ }
+ }
+
+ // @param tasks Array of strings (or falsy value, in which case no-op).
+ // Each element must be a valid JavaScript expression that yields a
+ // function. Or, can be an array of objects with "code" and "data"
+ // properties; in this case, the "code" property should be a string
+ // of JS that's an expr that yields a function, and "data" should be
+ // an object that will be added as an additional argument when that
+ // function is called.
+ // @param target The object that will be "this" for each function
+ // execution.
+ // @param args Array of arguments to be passed to the functions. (The
+ // same arguments will be passed to all functions.)
+ function evalAndRun(tasks, target, args) {
+ if (tasks) {
+ forEach(tasks, function(task) {
+ var theseArgs = args;
+ if (typeof(task) === "object") {
+ theseArgs = theseArgs.concat([task.data]);
+ task = task.code;
+ }
+ var taskFunc = eval("(" + task + ")");
+ if (typeof(taskFunc) !== "function") {
+ throw new Error("Task must be a function! Source:\n" + task);
+ }
+ taskFunc.apply(target, theseArgs);
+ });
+ }
+ }
+
+ function initSizing(el) {
+ var sizing = sizingPolicy(el);
+ if (!sizing)
+ return;
+
+ var cel = document.getElementById("htmlwidget_container");
+ if (!cel)
+ return;
+
+ if (typeof(sizing.padding) !== "undefined") {
+ document.body.style.margin = "0";
+ document.body.style.padding = paddingToCss(unpackPadding(sizing.padding));
+ }
+
+ if (sizing.fill) {
+ document.body.style.overflow = "hidden";
+ document.body.style.width = "100%";
+ document.body.style.height = "100%";
+ document.documentElement.style.width = "100%";
+ document.documentElement.style.height = "100%";
+ if (cel) {
+ cel.style.position = "absolute";
+ var pad = unpackPadding(sizing.padding);
+ cel.style.top = pad.top + "px";
+ cel.style.right = pad.right + "px";
+ cel.style.bottom = pad.bottom + "px";
+ cel.style.left = pad.left + "px";
+ el.style.width = "100%";
+ el.style.height = "100%";
+ }
+
+ return {
+ getWidth: function() { return cel.offsetWidth; },
+ getHeight: function() { return cel.offsetHeight; }
+ };
+
+ } else {
+ el.style.width = px(sizing.width);
+ el.style.height = px(sizing.height);
+
+ return {
+ getWidth: function() { return el.offsetWidth; },
+ getHeight: function() { return el.offsetHeight; }
+ };
+ }
+ }
+
+ // Default implementations for methods
+ var defaults = {
+ find: function(scope) {
+ return querySelectorAll(scope, "." + this.name);
+ },
+ renderError: function(el, err) {
+ var $el = $(el);
+
+ this.clearError(el);
+
+ // Add all these error classes, as Shiny does
+ var errClass = "shiny-output-error";
+ if (err.type !== null) {
+ // use the classes of the error condition as CSS class names
+ errClass = errClass + " " + $.map(asArray(err.type), function(type) {
+ return errClass + "-" + type;
+ }).join(" ");
+ }
+ errClass = errClass + " htmlwidgets-error";
+
+ // Is el inline or block? If inline or inline-block, just display:none it
+ // and add an inline error.
+ var display = $el.css("display");
+ $el.data("restore-display-mode", display);
+
+ if (display === "inline" || display === "inline-block") {
+ $el.hide();
+ if (err.message !== "") {
+ var errorSpan = $("").addClass(errClass);
+ errorSpan.text(err.message);
+ $el.after(errorSpan);
+ }
+ } else if (display === "block") {
+ // If block, add an error just after the el, set visibility:none on the
+ // el, and position the error to be on top of the el.
+ // Mark it with a unique ID and CSS class so we can remove it later.
+ $el.css("visibility", "hidden");
+ if (err.message !== "") {
+ var errorDiv = $("
").addClass(errClass).css("position", "absolute")
+ .css("top", el.offsetTop)
+ .css("left", el.offsetLeft)
+ // setting width can push out the page size, forcing otherwise
+ // unnecessary scrollbars to appear and making it impossible for
+ // the element to shrink; so use max-width instead
+ .css("maxWidth", el.offsetWidth)
+ .css("height", el.offsetHeight);
+ errorDiv.text(err.message);
+ $el.after(errorDiv);
+
+ // Really dumb way to keep the size/position of the error in sync with
+ // the parent element as the window is resized or whatever.
+ var intId = setInterval(function() {
+ if (!errorDiv[0].parentElement) {
+ clearInterval(intId);
+ return;
+ }
+ errorDiv
+ .css("top", el.offsetTop)
+ .css("left", el.offsetLeft)
+ .css("maxWidth", el.offsetWidth)
+ .css("height", el.offsetHeight);
+ }, 500);
+ }
+ }
+ },
+ clearError: function(el) {
+ var $el = $(el);
+ var display = $el.data("restore-display-mode");
+ $el.data("restore-display-mode", null);
+
+ if (display === "inline" || display === "inline-block") {
+ if (display)
+ $el.css("display", display);
+ $(el.nextSibling).filter(".htmlwidgets-error").remove();
+ } else if (display === "block"){
+ $el.css("visibility", "inherit");
+ $(el.nextSibling).filter(".htmlwidgets-error").remove();
+ }
+ },
+ sizing: {}
+ };
+
+ // Called by widget bindings to register a new type of widget. The definition
+ // object can contain the following properties:
+ // - name (required) - A string indicating the binding name, which will be
+ // used by default as the CSS classname to look for.
+ // - initialize (optional) - A function(el) that will be called once per
+ // widget element; if a value is returned, it will be passed as the third
+ // value to renderValue.
+ // - renderValue (required) - A function(el, data, initValue) that will be
+ // called with data. Static contexts will cause this to be called once per
+ // element; Shiny apps will cause this to be called multiple times per
+ // element, as the data changes.
+ window.HTMLWidgets.widget = function(definition) {
+ if (!definition.name) {
+ throw new Error("Widget must have a name");
+ }
+ if (!definition.type) {
+ throw new Error("Widget must have a type");
+ }
+ // Currently we only support output widgets
+ if (definition.type !== "output") {
+ throw new Error("Unrecognized widget type '" + definition.type + "'");
+ }
+ // TODO: Verify that .name is a valid CSS classname
+
+ // Support new-style instance-bound definitions. Old-style class-bound
+ // definitions have one widget "object" per widget per type/class of
+ // widget; the renderValue and resize methods on such widget objects
+ // take el and instance arguments, because the widget object can't
+ // store them. New-style instance-bound definitions have one widget
+ // object per widget instance; the definition that's passed in doesn't
+ // provide renderValue or resize methods at all, just the single method
+ // factory(el, width, height)
+ // which returns an object that has renderValue(x) and resize(w, h).
+ // This enables a far more natural programming style for the widget
+ // author, who can store per-instance state using either OO-style
+ // instance fields or functional-style closure variables (I guess this
+ // is in contrast to what can only be called C-style pseudo-OO which is
+ // what we required before).
+ if (definition.factory) {
+ definition = createLegacyDefinitionAdapter(definition);
+ }
+
+ if (!definition.renderValue) {
+ throw new Error("Widget must have a renderValue function");
+ }
+
+ // For static rendering (non-Shiny), use a simple widget registration
+ // scheme. We also use this scheme for Shiny apps/documents that also
+ // contain static widgets.
+ window.HTMLWidgets.widgets = window.HTMLWidgets.widgets || [];
+ // Merge defaults into the definition; don't mutate the original definition.
+ var staticBinding = extend({}, defaults, definition);
+ overrideMethod(staticBinding, "find", function(superfunc) {
+ return function(scope) {
+ var results = superfunc(scope);
+ // Filter out Shiny outputs, we only want the static kind
+ return filterByClass(results, "html-widget-output", false);
+ };
+ });
+ window.HTMLWidgets.widgets.push(staticBinding);
+
+ if (shinyMode) {
+ // Shiny is running. Register the definition with an output binding.
+ // The definition itself will not be the output binding, instead
+ // we will make an output binding object that delegates to the
+ // definition. This is because we foolishly used the same method
+ // name (renderValue) for htmlwidgets definition and Shiny bindings
+ // but they actually have quite different semantics (the Shiny
+ // bindings receive data that includes lots of metadata that it
+ // strips off before calling htmlwidgets renderValue). We can't
+ // just ignore the difference because in some widgets it's helpful
+ // to call this.renderValue() from inside of resize(), and if
+ // we're not delegating, then that call will go to the Shiny
+ // version instead of the htmlwidgets version.
+
+ // Merge defaults with definition, without mutating either.
+ var bindingDef = extend({}, defaults, definition);
+
+ // This object will be our actual Shiny binding.
+ var shinyBinding = new Shiny.OutputBinding();
+
+ // With a few exceptions, we'll want to simply use the bindingDef's
+ // version of methods if they are available, otherwise fall back to
+ // Shiny's defaults. NOTE: If Shiny's output bindings gain additional
+ // methods in the future, and we want them to be overrideable by
+ // HTMLWidget binding definitions, then we'll need to add them to this
+ // list.
+ delegateMethod(shinyBinding, bindingDef, "getId");
+ delegateMethod(shinyBinding, bindingDef, "onValueChange");
+ delegateMethod(shinyBinding, bindingDef, "onValueError");
+ delegateMethod(shinyBinding, bindingDef, "renderError");
+ delegateMethod(shinyBinding, bindingDef, "clearError");
+ delegateMethod(shinyBinding, bindingDef, "showProgress");
+
+ // The find, renderValue, and resize are handled differently, because we
+ // want to actually decorate the behavior of the bindingDef methods.
+
+ shinyBinding.find = function(scope) {
+ var results = bindingDef.find(scope);
+
+ // Only return elements that are Shiny outputs, not static ones
+ var dynamicResults = results.filter(".html-widget-output");
+
+ // It's possible that whatever caused Shiny to think there might be
+ // new dynamic outputs, also caused there to be new static outputs.
+ // Since there might be lots of different htmlwidgets bindings, we
+ // schedule execution for later--no need to staticRender multiple
+ // times.
+ if (results.length !== dynamicResults.length)
+ scheduleStaticRender();
+
+ return dynamicResults;
+ };
+
+ // Wrap renderValue to handle initialization, which unfortunately isn't
+ // supported natively by Shiny at the time of this writing.
+
+ shinyBinding.renderValue = function(el, data) {
+ Shiny.renderDependencies(data.deps);
+ // Resolve strings marked as javascript literals to objects
+ if (!(data.evals instanceof Array)) data.evals = [data.evals];
+ for (var i = 0; data.evals && i < data.evals.length; i++) {
+ window.HTMLWidgets.evaluateStringMember(data.x, data.evals[i]);
+ }
+ if (!bindingDef.renderOnNullValue) {
+ if (data.x === null) {
+ el.style.visibility = "hidden";
+ return;
+ } else {
+ el.style.visibility = "inherit";
+ }
+ }
+ if (!elementData(el, "initialized")) {
+ initSizing(el);
+
+ elementData(el, "initialized", true);
+ if (bindingDef.initialize) {
+ var result = bindingDef.initialize(el, el.offsetWidth,
+ el.offsetHeight);
+ elementData(el, "init_result", result);
+ }
+ }
+ bindingDef.renderValue(el, data.x, elementData(el, "init_result"));
+ evalAndRun(data.jsHooks.render, elementData(el, "init_result"), [el, data.x]);
+ };
+
+ // Only override resize if bindingDef implements it
+ if (bindingDef.resize) {
+ shinyBinding.resize = function(el, width, height) {
+ // Shiny can call resize before initialize/renderValue have been
+ // called, which doesn't make sense for widgets.
+ if (elementData(el, "initialized")) {
+ bindingDef.resize(el, width, height, elementData(el, "init_result"));
+ }
+ };
+ }
+
+ Shiny.outputBindings.register(shinyBinding, bindingDef.name);
+ }
+ };
+
+ var scheduleStaticRenderTimerId = null;
+ function scheduleStaticRender() {
+ if (!scheduleStaticRenderTimerId) {
+ scheduleStaticRenderTimerId = setTimeout(function() {
+ scheduleStaticRenderTimerId = null;
+ window.HTMLWidgets.staticRender();
+ }, 1);
+ }
+ }
+
+ // Render static widgets after the document finishes loading
+ // Statically render all elements that are of this widget's class
+ window.HTMLWidgets.staticRender = function() {
+ var bindings = window.HTMLWidgets.widgets || [];
+ forEach(bindings, function(binding) {
+ var matches = binding.find(document.documentElement);
+ forEach(matches, function(el) {
+ var sizeObj = initSizing(el, binding);
+
+ if (hasClass(el, "html-widget-static-bound"))
+ return;
+ el.className = el.className + " html-widget-static-bound";
+
+ var initResult;
+ if (binding.initialize) {
+ initResult = binding.initialize(el,
+ sizeObj ? sizeObj.getWidth() : el.offsetWidth,
+ sizeObj ? sizeObj.getHeight() : el.offsetHeight
+ );
+ elementData(el, "init_result", initResult);
+ }
+
+ if (binding.resize) {
+ var lastSize = {};
+ var resizeHandler = function(e) {
+ var size = {
+ w: sizeObj ? sizeObj.getWidth() : el.offsetWidth,
+ h: sizeObj ? sizeObj.getHeight() : el.offsetHeight
+ };
+ if (size.w === 0 && size.h === 0)
+ return;
+ if (size.w === lastSize.w && size.h === lastSize.h)
+ return;
+ lastSize = size;
+ binding.resize(el, size.w, size.h, initResult);
+ };
+
+ on(window, "resize", resizeHandler);
+
+ // This is needed for cases where we're running in a Shiny
+ // app, but the widget itself is not a Shiny output, but
+ // rather a simple static widget. One example of this is
+ // an rmarkdown document that has runtime:shiny and widget
+ // that isn't in a render function. Shiny only knows to
+ // call resize handlers for Shiny outputs, not for static
+ // widgets, so we do it ourselves.
+ if (window.jQuery) {
+ window.jQuery(document).on(
+ "shown.htmlwidgets shown.bs.tab.htmlwidgets shown.bs.collapse.htmlwidgets",
+ resizeHandler
+ );
+ window.jQuery(document).on(
+ "hidden.htmlwidgets hidden.bs.tab.htmlwidgets hidden.bs.collapse.htmlwidgets",
+ resizeHandler
+ );
+ }
+
+ // This is needed for the specific case of ioslides, which
+ // flips slides between display:none and display:block.
+ // Ideally we would not have to have ioslide-specific code
+ // here, but rather have ioslides raise a generic event,
+ // but the rmarkdown package just went to CRAN so the
+ // window to getting that fixed may be long.
+ if (window.addEventListener) {
+ // It's OK to limit this to window.addEventListener
+ // browsers because ioslides itself only supports
+ // such browsers.
+ on(document, "slideenter", resizeHandler);
+ on(document, "slideleave", resizeHandler);
+ }
+ }
+
+ var scriptData = document.querySelector("script[data-for='" + el.id + "'][type='application/json']");
+ if (scriptData) {
+ var data = JSON.parse(scriptData.textContent || scriptData.text);
+ // Resolve strings marked as javascript literals to objects
+ if (!(data.evals instanceof Array)) data.evals = [data.evals];
+ for (var k = 0; data.evals && k < data.evals.length; k++) {
+ window.HTMLWidgets.evaluateStringMember(data.x, data.evals[k]);
+ }
+ binding.renderValue(el, data.x, initResult);
+ evalAndRun(data.jsHooks.render, initResult, [el, data.x]);
+ }
+ });
+ });
+
+ invokePostRenderHandlers();
+ }
+
+ // Wait until after the document has loaded to render the widgets.
+ if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", function() {
+ document.removeEventListener("DOMContentLoaded", arguments.callee, false);
+ window.HTMLWidgets.staticRender();
+ }, false);
+ } else if (document.attachEvent) {
+ document.attachEvent("onreadystatechange", function() {
+ if (document.readyState === "complete") {
+ document.detachEvent("onreadystatechange", arguments.callee);
+ window.HTMLWidgets.staticRender();
+ }
+ });
+ }
+
+
+ window.HTMLWidgets.getAttachmentUrl = function(depname, key) {
+ // If no key, default to the first item
+ if (typeof(key) === "undefined")
+ key = 1;
+
+ var link = document.getElementById(depname + "-" + key + "-attachment");
+ if (!link) {
+ throw new Error("Attachment " + depname + "/" + key + " not found in document");
+ }
+ return link.getAttribute("href");
+ };
+
+ window.HTMLWidgets.dataframeToD3 = function(df) {
+ var names = [];
+ var length;
+ for (var name in df) {
+ if (df.hasOwnProperty(name))
+ names.push(name);
+ if (typeof(df[name]) !== "object" || typeof(df[name].length) === "undefined") {
+ throw new Error("All fields must be arrays");
+ } else if (typeof(length) !== "undefined" && length !== df[name].length) {
+ throw new Error("All fields must be arrays of the same length");
+ }
+ length = df[name].length;
+ }
+ var results = [];
+ var item;
+ for (var row = 0; row < length; row++) {
+ item = {};
+ for (var col = 0; col < names.length; col++) {
+ item[names[col]] = df[names[col]][row];
+ }
+ results.push(item);
+ }
+ return results;
+ };
+
+ window.HTMLWidgets.transposeArray2D = function(array) {
+ if (array.length === 0) return array;
+ var newArray = array[0].map(function(col, i) {
+ return array.map(function(row) {
+ return row[i]
+ })
+ });
+ return newArray;
+ };
+ // Split value at splitChar, but allow splitChar to be escaped
+ // using escapeChar. Any other characters escaped by escapeChar
+ // will be included as usual (including escapeChar itself).
+ function splitWithEscape(value, splitChar, escapeChar) {
+ var results = [];
+ var escapeMode = false;
+ var currentResult = "";
+ for (var pos = 0; pos < value.length; pos++) {
+ if (!escapeMode) {
+ if (value[pos] === splitChar) {
+ results.push(currentResult);
+ currentResult = "";
+ } else if (value[pos] === escapeChar) {
+ escapeMode = true;
+ } else {
+ currentResult += value[pos];
+ }
+ } else {
+ currentResult += value[pos];
+ escapeMode = false;
+ }
+ }
+ if (currentResult !== "") {
+ results.push(currentResult);
+ }
+ return results;
+ }
+ // Function authored by Yihui/JJ Allaire
+ window.HTMLWidgets.evaluateStringMember = function(o, member) {
+ var parts = splitWithEscape(member, '.', '\\');
+ for (var i = 0, l = parts.length; i < l; i++) {
+ var part = parts[i];
+ // part may be a character or 'numeric' member name
+ if (o !== null && typeof o === "object" && part in o) {
+ if (i == (l - 1)) { // if we are at the end of the line then evalulate
+ if (typeof o[part] === "string")
+ o[part] = eval("(" + o[part] + ")");
+ } else { // otherwise continue to next embedded object
+ o = o[part];
+ }
+ }
+ }
+ };
+
+ // Retrieve the HTMLWidget instance (i.e. the return value of an
+ // HTMLWidget binding's initialize() or factory() function)
+ // associated with an element, or null if none.
+ window.HTMLWidgets.getInstance = function(el) {
+ return elementData(el, "init_result");
+ };
+
+ // Finds the first element in the scope that matches the selector,
+ // and returns the HTMLWidget instance (i.e. the return value of
+ // an HTMLWidget binding's initialize() or factory() function)
+ // associated with that element, if any. If no element matches the
+ // selector, or the first matching element has no HTMLWidget
+ // instance associated with it, then null is returned.
+ //
+ // The scope argument is optional, and defaults to window.document.
+ window.HTMLWidgets.find = function(scope, selector) {
+ if (arguments.length == 1) {
+ selector = scope;
+ scope = document;
+ }
+
+ var el = scope.querySelector(selector);
+ if (el === null) {
+ return null;
+ } else {
+ return window.HTMLWidgets.getInstance(el);
+ }
+ };
+
+ // Finds all elements in the scope that match the selector, and
+ // returns the HTMLWidget instances (i.e. the return values of
+ // an HTMLWidget binding's initialize() or factory() function)
+ // associated with the elements, in an array. If elements that
+ // match the selector don't have an associated HTMLWidget
+ // instance, the returned array will contain nulls.
+ //
+ // The scope argument is optional, and defaults to window.document.
+ window.HTMLWidgets.findAll = function(scope, selector) {
+ if (arguments.length == 1) {
+ selector = scope;
+ scope = document;
+ }
+
+ var nodes = scope.querySelectorAll(selector);
+ var results = [];
+ for (var i = 0; i < nodes.length; i++) {
+ results.push(window.HTMLWidgets.getInstance(nodes[i]));
+ }
+ return results;
+ };
+
+ var postRenderHandlers = [];
+ function invokePostRenderHandlers() {
+ while (postRenderHandlers.length) {
+ var handler = postRenderHandlers.shift();
+ if (handler) {
+ handler();
+ }
+ }
+ }
+
+ // Register the given callback function to be invoked after the
+ // next time static widgets are rendered.
+ window.HTMLWidgets.addPostRenderHandler = function(callback) {
+ postRenderHandlers.push(callback);
+ };
+
+ // Takes a new-style instance-bound definition, and returns an
+ // old-style class-bound definition. This saves us from having
+ // to rewrite all the logic in this file to accomodate both
+ // types of definitions.
+ function createLegacyDefinitionAdapter(defn) {
+ var result = {
+ name: defn.name,
+ type: defn.type,
+ initialize: function(el, width, height) {
+ return defn.factory(el, width, height);
+ },
+ renderValue: function(el, x, instance) {
+ return instance.renderValue(x);
+ },
+ resize: function(el, width, height, instance) {
+ return instance.resize(width, height);
+ }
+ };
+
+ if (defn.find)
+ result.find = defn.find;
+ if (defn.renderError)
+ result.renderError = defn.renderError;
+ if (defn.clearError)
+ result.clearError = defn.clearError;
+
+ return result;
+ }
+})();
+
diff --git a/docs/articles/bob_ross.html b/docs/articles/bob_ross.html
index 4d74120..74a0405 100644
--- a/docs/articles/bob_ross.html
+++ b/docs/articles/bob_ross.html
@@ -68,6 +68,9 @@
In order to better represent this data available on the profanities used in Tarantino’s movies, it is beneficial to first divide the swear words used into categories via the word variable. For the purposes of this analysis, eight were defined and stored in the swear_category variable:
Due to CRAN space limitations on packages, user-contributed vignettes that walk through different analyses using the data sets in the fivethirtyeight package are linked below in this “vignette of vignettes.” You can find both the R Markdown file needed to generate the file and also a link to the HTML vignette on the package website at https://fivethirtyeight-r.netlify.com. The vignette title links to the HTML version and the (Rmd) immediately following links to the R Markdown source. We encourage others to share their analyses using the fivethirtyeight data sets.
+
The developmental version of the package stored on GitHub contains all of the vignettes so if you’d like to build the package locally, first install the remotes package and then install the package via
# If you haven't installed the remotes package yet, do so:# install.packages("remotes")
-remotes::install_github("rudeboybert/fivethirtyeight", build_vignettes =TRUE)
Note for now mayweather_mcgregor_tweets, mlb_elo, nba_carmelo, nfl_elo, senators, only include the first 10 rows of the data because of R package file size restrictions (< 5MB tarballs); code to download/process the entire dataset are included in help files. We hope to include full versions of these datasets in v0.5.0 of package using the drat package.
Converted all ordinal categorical variables to factor(..., ordered = TRUE). Ex: bechdel$clean_test
+
Vignette notes:
+
+
Added a vignette that has a link to all user-contributed vignettes, which areonly available on development version of package and on GitHub due to CRAN package size restrictions.
+
For all datasets that have a user contributed vignette, add a link to it in the corresponding help/roxygen code file.
Eliminates connote either an elimination (starts with "E") or a rose
-(starts with "R"). Eliminations supercede roses. "E" connotes a standard
+(starts with "R"). Eliminations supersede roses. "E" connotes a standard
elimination, typically at a rose ceremony. "EQ" means the contestant quits.
"EF" means the contestant was fired by production. "ED" connotes a date
elimination. "EU" connotes an unscheduled elimination, one that takes place
at a time outside of a date or rose ceremony. "R" means the contestant
received a rose. "R1" means the contestant got a first impression rose.
"D1" means a one-on-one date, "D2" means a 2-on-1, "D3" means a 3-on-1
-group date, and so on. Weeks of the show are deliminated by rose
+group date, and so on. Weeks of the show are eliminated by rose
ceremonies, and may not line up exactly with episodes.
Their occupation or office, according to Google's Knowledge Graph or, if they're not in there, how Stewart introduced them on the program.
show
Air date of episode. Not unique, as some shows had more than one guest
group
A larger group designation for the occupation. For instance, us senators, us presidents, and former presidents are all under "politicians"
-
raw_guest_list
The person or list of people who appeared on the show, according to Wikipedia. The GoogleKnowlege_Occupation only refers to one of them in a given row.
+
raw_guest_list
The person or list of people who appeared on the show, according to Wikipedia. The GoogleKnowledge_Occupation only refers to one of them in a given row.
Source
-
Google Knowlege Graph, The Daily Show clip library, Wikipedia.
+
Google Knowledge Graph, The Daily Show clip library, Wikipedia.
A data frame with 12118 rows representing tweets and 7 variables:
+
Because of R package size restrictions, only a preview of the
+first 10 rows of this dataset is included; to obtain the entire dataset
+(12118 rows) see Examples below. A data frame with 10 rows representing tweets and 7 variables:
created_at
Time and date at which the tweet associated with the Mayweather vs. McGregor fight was sent.
emojis
Whether or not emojis were used in the tweet about the fight.
id
A numerical identifier for each individual tweet about the fight.
# To obtain the entire dataset, run the code inside the following if statement:
+if(FALSE){
+ library(tidyverse)
+ url<-
+ "https://raw.githubusercontent.com/fivethirtyeight/data/master/mayweather-mcgregor/tweets.csv"
+ mayweather_mcgregor_tweets<-read_csv(url) %>%
+ mutate(
+ emojis=as.logical(emojis),
+ retweeted=as.logical(retweeted),
+ id=as.character(id)
+ )
+}
The Complete History Of The NFL 2017 NFL Predictions
Format
-
a data frame with 16,007 rows representing games and 14 variables:
+
Because of R package size restrictions, only a preview of the
+first 10 rows of this dataset is included; to obtain the entire dataset
+(1920 to 2018 games) see Examples below. A data frame with 10 rows
+representing games and 14 variables:
date
Date
season
Season year, 1920-2018
neutral
TRUE if the game was played on neutral territory, FALSE if not
Formata data frame with 33 rows representing teams and 25 variables:
team
NFL team
total_respondents
Total number of poll respondents who ranked the given team in their top 3 favorites
-
asian_dem
Number of asian, democrat poll respondents who ranked the given team in their top 3 favorites
-
black_dem
Number of black, democrat poll respondents who ranked the given team in their top 3 favorites
-
hispanic_dem
Number of hispanic, democrat poll respondents who ranked the given team in their top 3 favorites
-
other_dem
Number of democrat poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites
-
white_dem
Number of white, democrat poll respondents who ranked the given team in their top 3 favorites
+
asian_dem
Number of Asian, democrat poll respondents who ranked the given team in their top 3 favorites
+
black_dem
Number of Black, democrat poll respondents who ranked the given team in their top 3 favorites
+
hispanic_dem
Number of Hispanic, democrat poll respondents who ranked the given team in their top 3 favorites
+
other_dem
Number of democrat poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites
+
white_dem
Number of White, democrat poll respondents who ranked the given team in their top 3 favorites
total_dem
Total number of democrat poll respondents who ranked the given team in their top 3 favorites
-
asian_ind
Number of asian, independent poll respondents who ranked the given team in their top 3 favorites
-
black_ind
Number of black, independent poll respondents who ranked the given team in their top 3 favorites
-
hispanic_ind
Number of hispanic, independent poll respondents who ranked the given team in their top 3 favorites
-
other_ind
Number of independent poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites
-
white_ind
Number of white, independent poll respondents who ranked the given team in their top 3 favorites
+
asian_ind
Number of Asian, independent poll respondents who ranked the given team in their top 3 favorites
+
black_ind
Number of Black, independent poll respondents who ranked the given team in their top 3 favorites
+
hispanic_ind
Number of Hispanic, independent poll respondents who ranked the given team in their top 3 favorites
+
other_ind
Number of independent poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites
+
white_ind
Number of White, independent poll respondents who ranked the given team in their top 3 favorites
total_ind
Total number of independent poll respondents who ranked the given team in their top 3 favorites
-
asian_gop
Number of asian, republican poll respondents who ranked the given team in their top 3 favorites
-
black_gop
Number of black, republican poll respondents who ranked the given team in their top 3 favorites
-
hispanic_gop
Number of hispanic, republican poll respondents who ranked the given team in their top 3 favorites
-
other_gop
Number of republican poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites
-
white_gop
Number of white, republican poll respondents who ranked the given team in their top 3 favorites
+
asian_gop
Number of Asian, republican poll respondents who ranked the given team in their top 3 favorites
+
black_gop
Number of Black, republican poll respondents who ranked the given team in their top 3 favorites
+
hispanic_gop
Number of Hispanic, republican poll respondents who ranked the given team in their top 3 favorites
+
other_gop
Number of republican poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites
+
white_gop
Number of White, republican poll respondents who ranked the given team in their top 3 favorites
total_gop
Total number of republican poll respondents who ranked the given team in their top 3 favorites
gop_percent
Percent of fans (who ranked the team in their top 3 favorite NFL teams) who are republicans
A data frame with 32 rows representng years and 40 variables:
+
A data frame with 32 rows representing years and 40 variables:
year
Year the poll was conducted
avg
The average percentage people who answered the poll question positively (support the president or have a favorable view of the U.S.)
canada
The percentage of people from Canada who answered the poll question positively
@@ -152,7 +155,7 @@
Formatphilippines
The percentage of people from the Philippines who answered the poll question positively
south_korea
The percentage of people from South Korea who answered the poll question positively
vietnam
The percentage of people from Vietnam who answered the poll question positively
-
israel
The percentage of people from Isreal who answered the poll question positively
+
israel
The percentage of people from Israel who answered the poll question positively
jordan
The percentage of people from Jordan who answered the poll question positively
lebanon
The percentage of people from Lebanon who answered the poll question positively
tunisia
The percentage of people from Tunisia who answered the poll question positively
@@ -170,7 +173,7 @@
Formatmexico
The percentage of people from Mexico who answered the poll question positively
peru
The percentage of people from Peru who answered the poll question positively
venezuela
The percentage of people from Venezuela who answered the poll question positively
-
question
The item being polled. Specificially, whether respondents: 1) Have a favorable view of the U.S. or 2) Trust the U.S. President when it comes to foreign affairs
+
question
The item being polled. Specifically, whether respondents: 1) Have a favorable view of the U.S. or 2) Trust the U.S. President when it comes to foreign affairs
diff --git a/man/ahca_polls.Rd b/man/ahca_polls.Rd
index 6842d09..1987a1a 100644
--- a/man/ahca_polls.Rd
+++ b/man/ahca_polls.Rd
@@ -10,7 +10,7 @@
\item{end}{End date of the poll.}
\item{pollster}{The entity that conducts and collects information from the poll.}
\item{favor}{The number of affirmative responses to the question at the pollster.}
- \item{oppose}{The number of negative reponses to the question at the pollster.}
+ \item{oppose}{The number of negative responses to the question at the pollster.}
\item{url}{The website associated with the polling question.}
\item{text}{The polling question asked at the pollster.}
}}
diff --git a/man/bachelorette.Rd b/man/bachelorette.Rd
index d228164..df8019e 100644
--- a/man/bachelorette.Rd
+++ b/man/bachelorette.Rd
@@ -39,21 +39,21 @@ bachelorette
}
\description{
The raw data behind the stories:
-"How To Spot A Front-Runner On The ‘Bachelor’ Or ‘Bachelorette’"
-\url{https://fivethirtyeight.com/features/the-bachelorette/}, "Rachel’s Season Is Fitting Neatly Into ‘Bachelorette’ History"
-\url{https://fivethirtyeight.com/features/rachels-season-is-fitting-neatly-into-bachelorette-history/}, and "Rachel Lindsay’s ‘Bachelorette’ Season, In Three Charts"
+"How To Spot A Front-Runner On The 'Bachelor' Or 'Bachelorette'"
+\url{https://fivethirtyeight.com/features/the-bachelorette/}, "Rachel's Season Is Fitting Neatly Into 'Bachelorette' History"
+\url{https://fivethirtyeight.com/features/rachels-season-is-fitting-neatly-into-bachelorette-history/}, and "Rachel Lindsay's 'Bachelorette' Season, In Three Charts"
\url{https://fivethirtyeight.com/features/rachel-lindsays-bachelorette-season-in-three-charts/}.
}
\details{
Eliminates connote either an elimination (starts with "E") or a rose
-(starts with "R"). Eliminations supercede roses. "E" connotes a standard
+(starts with "R"). Eliminations supersede roses. "E" connotes a standard
elimination, typically at a rose ceremony. "EQ" means the contestant quits.
"EF" means the contestant was fired by production. "ED" connotes a date
elimination. "EU" connotes an unscheduled elimination, one that takes place
at a time outside of a date or rose ceremony. "R" means the contestant
received a rose. "R1" means the contestant got a first impression rose.
"D1" means a one-on-one date, "D2" means a 2-on-1, "D3" means a 3-on-1
-group date, and so on. Weeks of the show are deliminated by rose
+group date, and so on. Weeks of the show are eliminated by rose
ceremonies, and may not line up exactly with episodes.
}
\keyword{datasets}
diff --git a/man/biopics.Rd b/man/biopics.Rd
index 391dd9e..776070e 100644
--- a/man/biopics.Rd
+++ b/man/biopics.Rd
@@ -31,5 +31,7 @@ biopics
The raw data behind the story
"'Straight Outta Compton' Is The Rare Biopic Not About White Dudes"
\url{https://fivethirtyeight.com/features/straight-outta-compton-is-the-rare-biopic-not-about-white-dudes/}.
+An analysis using this data was contributed by Pradeep Adhokshaja as a package vignette at
+\url{http://fivethirtyeight-r.netlify.com/articles/biopics.html}.
}
\keyword{datasets}
diff --git a/man/bob_ross.Rd b/man/bob_ross.Rd
index 49bdc75..5326a15 100644
--- a/man/bob_ross.Rd
+++ b/man/bob_ross.Rd
@@ -88,6 +88,8 @@ bob_ross
The raw data behind the story
"A Statistical Analysis of the Work of Bob Ross"
\url{https://fivethirtyeight.com/features/a-statistical-analysis-of-the-work-of-bob-ross/}.
+An analysis using this data was contributed by Jonathan Bouchet as a package vignette at
+\url{http://fivethirtyeight-r.netlify.com/articles/bob_ross.html}.
}
\examples{
# To convert data frame to tidy data (long) format, run:
diff --git a/man/chess_transfers.Rd b/man/chess_transfers.Rd
index 4329c33..9db9f6a 100644
--- a/man/chess_transfers.Rd
+++ b/man/chess_transfers.Rd
@@ -7,9 +7,9 @@
\format{A data frame with 932 rows representing international player transfers and 5 variables:
\describe{
\item{url}{The corresponding website on the World Chess Federation page which details the transfers of a given year.}
- \item{id}{An numeric identifier for the chess player who transfered.}
+ \item{id}{An numeric identifier for the chess player who transferred.}
\item{federation}{The current national federation of the chess player}
- \item{form_fed}{The national federation from which the chress player has transfered.}
+ \item{form_fed}{The national federation from which the chess player has transferred.}
\item{transfer_date}{The date at which the transfer took place.}
}}
\source{
diff --git a/man/college_all_ages.Rd b/man/college_all_ages.Rd
index bc3fff1..1da5a10 100644
--- a/man/college_all_ages.Rd
+++ b/man/college_all_ages.Rd
@@ -14,7 +14,7 @@
\item{employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
\item{unemployed}{Number unemployed (ESR == 3)}
\item{unemployment_rate}{Unemployed / (Unemployed + Employed)}
- \item{p25th}{25th percentile of earnigns}
+ \item{p25th}{25th percentile of earnings}
\item{median}{Median earnings of full-time, year-round workers}
\item{p75th}{75th percentile of earnings}
}}
diff --git a/man/college_grad_students.Rd b/man/college_grad_students.Rd
index 7f8274f..9a1d2fd 100644
--- a/man/college_grad_students.Rd
+++ b/man/college_grad_students.Rd
@@ -15,7 +15,7 @@
\item{grad_employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
\item{grad_unemployed}{Number unemployed (ESR == 3)}
\item{grad_unemployment_rate}{Unemployed / (Unemployed + Employed)}
- \item{grad_p25th}{25th percentile of earnigns}
+ \item{grad_p25th}{25th percentile of earnings}
\item{grad_median}{Median earnings of full-time, year-round workers}
\item{grad_p75th}{75th percentile of earnings}
\item{nongrad_total}{Total number of people with major}
@@ -23,7 +23,7 @@
\item{nongrad_employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
\item{nongrad_unemployed}{Number unemployed (ESR == 3)}
\item{nongrad_unemployment_rate}{Unemployed / (Unemployed + Employed)}
- \item{nongrad_p25th}{25th percentile of earnigns}
+ \item{nongrad_p25th}{25th percentile of earnings}
\item{nongrad_median}{Median earnings of full-time, year-round workers}
\item{nongrad_p75th}{75th percentile of earnings}
\item{grad_share}{grad_total / (grad_total + nongrad_total)}
diff --git a/man/college_recent_grads.Rd b/man/college_recent_grads.Rd
index b446340..03d6ecb 100644
--- a/man/college_recent_grads.Rd
+++ b/man/college_recent_grads.Rd
@@ -21,7 +21,7 @@
\item{employed_fulltime_yearround}{Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)}
\item{unemployed}{Number unemployed (ESR == 3)}
\item{unemployment_rate}{Unemployed / (Unemployed + Employed)}
- \item{p25th}{25th percentile of earnigns}
+ \item{p25th}{25th percentile of earnings}
\item{median}{Median earnings of full-time, year-round workers}
\item{p75th}{75th percentile of earnings}
\item{college_jobs}{Number with job requiring a college degree}
diff --git a/man/comic_characters.Rd b/man/comic_characters.Rd
index 50ea332..f1e3c58 100644
--- a/man/comic_characters.Rd
+++ b/man/comic_characters.Rd
@@ -37,5 +37,7 @@ comic_characters
The raw data behind the story
"Comic Books Are Still Made By Men, For Men And About Men"
\url{https://fivethirtyeight.com/features/women-in-comic-books/}.
+An analysis using this data was contributed by Jonathan Bouchet as a package vignette at
+\url{http://fivethirtyeight-r.netlify.com/articles/comics_gender.html}.
}
\keyword{datasets}
diff --git a/man/comma_survey.Rd b/man/comma_survey.Rd
index eb930f9..8f6c1ea 100644
--- a/man/comma_survey.Rd
+++ b/man/comma_survey.Rd
@@ -21,7 +21,7 @@
\item{care_proper_grammar}{In your opinion, how important or unimportant is proper use of grammar?}
}}
\source{
-See \url{https://github.com/fivethirtyeight/data/tree/master/comma-survey-data}.
+See \url{https://github.com/fivethirtyeight/data/tree/master/comma-survey}.
}
\usage{
comma_survey
diff --git a/man/daily_show_guests.Rd b/man/daily_show_guests.Rd
index fbdcbfb..ecff2c4 100644
--- a/man/daily_show_guests.Rd
+++ b/man/daily_show_guests.Rd
@@ -10,10 +10,10 @@
\item{google_knowledge_occupation}{Their occupation or office, according to Google's Knowledge Graph or, if they're not in there, how Stewart introduced them on the program.}
\item{show}{Air date of episode. Not unique, as some shows had more than one guest}
\item{group}{A larger group designation for the occupation. For instance, us senators, us presidents, and former presidents are all under "politicians"}
- \item{raw_guest_list}{The person or list of people who appeared on the show, according to Wikipedia. The GoogleKnowlege_Occupation only refers to one of them in a given row.}
+ \item{raw_guest_list}{The person or list of people who appeared on the show, according to Wikipedia. The GoogleKnowledge_Occupation only refers to one of them in a given row.}
}}
\source{
-Google Knowlege Graph, The Daily Show clip library, Wikipedia.
+Google Knowledge Graph, The Daily Show clip library, Wikipedia.
}
\usage{
daily_show_guests
diff --git a/man/drinks.Rd b/man/drinks.Rd
index 475cc82..c4de118 100644
--- a/man/drinks.Rd
+++ b/man/drinks.Rd
@@ -13,7 +13,7 @@
\item{total_litres_of_pure_alcohol}{Total litres of pure alcohol per person}
}}
\source{
-World Health Organisation, Global Information System on Alcohol and Health (GISAH), 2010.
+World Health Organization, Global Information System on Alcohol and Health (GISAH), 2010.
}
\usage{
drinks
diff --git a/man/goose.Rd b/man/goose.Rd
index 4aced63..1450402 100644
--- a/man/goose.Rd
+++ b/man/goose.Rd
@@ -15,7 +15,7 @@
\item{mehs}{Mehs}
\item{league_average_gpct}{League-average goose percentage}
\item{ppf}{Pitcher park factor}
- \item{replacement_gpct}{Replacement-level goose pecentage}
+ \item{replacement_gpct}{Replacement-level goose percentage}
\item{gwar}{Goose Wins Above Replacement}
\item{key_retro}{Retrosheet unique player identifier}
}}
diff --git a/man/mayweather_mcgregor_tweets.Rd b/man/mayweather_mcgregor_tweets.Rd
index d57d13a..2d9a26b 100644
--- a/man/mayweather_mcgregor_tweets.Rd
+++ b/man/mayweather_mcgregor_tweets.Rd
@@ -4,7 +4,9 @@
\name{mayweather_mcgregor_tweets}
\alias{mayweather_mcgregor_tweets}
\title{Mayweather Vs McGregor Tweets}
-\format{A data frame with 12118 rows representing tweets and 7 variables:
+\format{Because of R package size restrictions, only a preview of the
+first 10 rows of this dataset is included; to obtain the entire dataset
+(12118 rows) see Examples below. A data frame with 10 rows representing tweets and 7 variables:
\describe{
\item{created_at}{Time and date at which the tweet associated with the Mayweather vs. McGregor fight was sent.}
\item{emojis}{Whether or not emojis were used in the tweet about the fight.}
@@ -29,4 +31,18 @@ The raw data behind the story
"The Mayweather-McGregor Fight As Told Through Emojis"
\url{https://fivethirtyeight.com/?post_type=fte_features&p=161615}.
}
+\examples{
+# To obtain the entire dataset, run the code inside the following if statement:
+if(FALSE){
+ library(tidyverse)
+ url <-
+ "https://raw.githubusercontent.com/fivethirtyeight/data/master/mayweather-mcgregor/tweets.csv"
+ mayweather_mcgregor_tweets <- read_csv(url) \%>\%
+ mutate(
+ emojis = as.logical(emojis),
+ retweeted = as.logical(retweeted),
+ id = as.character(id)
+ )
+}
+}
\keyword{datasets}
diff --git a/man/mlb_as_play_talent.Rd b/man/mlb_as_play_talent.Rd
index 2481e58..9be6d27 100644
--- a/man/mlb_as_play_talent.Rd
+++ b/man/mlb_as_play_talent.Rd
@@ -11,7 +11,7 @@
\item{gamenum}{Order of All-Star Game for the season (in years w/ multiple ASGs; set to 0 when only 1 per year)}
\item{gameid}{Game ID at Baseball-Reference.com}
\item{lgid}{League of All-Star team}
- \item{startingpos}{Postion (according to baseball convention; 1=pitcher, 2=catcher, etc.) if starter}
+ \item{startingpos}{Position (according to baseball convention; 1=pitcher, 2=catcher, etc.) if starter}
\item{off600}{Estimate of offensive talent, in runs above league average per 600 plate appearances}
\item{def600}{Estimate of fielding talent, in runs above league average per 600 plate appearances}
\item{pitch200}{Estimate of pitching talent, in runs above league average per 200 innings pitched}
diff --git a/man/nba_draft_2015.Rd b/man/nba_draft_2015.Rd
index 24b6cc7..c940d65 100644
--- a/man/nba_draft_2015.Rd
+++ b/man/nba_draft_2015.Rd
@@ -26,5 +26,7 @@ nba_draft_2015
The raw data behind the story
"Projecting The Top 50 Players In The 2015 NBA Draft Class"
\url{https://fivethirtyeight.com/features/projecting-the-top-50-players-in-the-2015-nba-draft-class/}.
+An analysis using this data was contributed by G. Elliott Morris as a package vignette at
+\url{http://fivethirtyeight-r.netlify.com/articles/nba.html}.
}
\keyword{datasets}
diff --git a/man/nfl_elo.Rd b/man/nfl_elo.Rd
index c0de48f..aa4036e 100644
--- a/man/nfl_elo.Rd
+++ b/man/nfl_elo.Rd
@@ -4,7 +4,10 @@
\name{nfl_elo}
\alias{nfl_elo}
\title{The Complete History Of The NFL 2017 NFL Predictions}
-\format{a data frame with 16,007 rows representing games and 14 variables:
+\format{Because of R package size restrictions, only a preview of the
+first 10 rows of this dataset is included; to obtain the entire dataset
+(1920 to 2018 games) see Examples below. A data frame with 10 rows
+representing games and 14 variables:
\describe{
\item{date}{Date}
\item{season}{Season year, 1920-2018}
@@ -23,6 +26,15 @@
}}
\source{
See \url{https://projects.fivethirtyeight.com/nfl-api/nfl_elo.csv}
+# To obtain the entire dataset, run the following code:
+library(tidyverse)
+library(janitor)
+nfl_elo <- read_csv("https://projects.fivethirtyeight.com/nfl-api/nfl_elo.csv") %>%
+ clean_names() %>%
+ mutate(
+ team1 = as.factor(team1),
+ team2 = as.factor(team2),
+ neutral = ifelse(neutral == 1, TRUE, FALSE))
}
\usage{
nfl_elo
diff --git a/man/nfl_fandom_surveymonkey.Rd b/man/nfl_fandom_surveymonkey.Rd
index 70372a7..211efd2 100644
--- a/man/nfl_fandom_surveymonkey.Rd
+++ b/man/nfl_fandom_surveymonkey.Rd
@@ -8,29 +8,29 @@
\describe{
\item{team}{NFL team}
\item{total_respondents}{Total number of poll respondents who ranked the given team in their top 3 favorites}
-\item{asian_dem}{Number of asian, democrat poll respondents who ranked the given team in their top 3 favorites}
-\item{black_dem}{Number of black, democrat poll respondents who ranked the given team in their top 3 favorites}
-\item{hispanic_dem}{Number of hispanic, democrat poll respondents who ranked the given team in their top 3 favorites}
-\item{other_dem}{Number of democrat poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites}
-\item{white_dem}{Number of white, democrat poll respondents who ranked the given team in their top 3 favorites}
+\item{asian_dem}{Number of Asian, democrat poll respondents who ranked the given team in their top 3 favorites}
+\item{black_dem}{Number of Black, democrat poll respondents who ranked the given team in their top 3 favorites}
+\item{hispanic_dem}{Number of Hispanic, democrat poll respondents who ranked the given team in their top 3 favorites}
+\item{other_dem}{Number of democrat poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites}
+\item{white_dem}{Number of White, democrat poll respondents who ranked the given team in their top 3 favorites}
\item{total_dem}{Total number of democrat poll respondents who ranked the given team in their top 3 favorites}
-\item{asian_ind}{Number of asian, independent poll respondents who ranked the given team in their top 3 favorites}
-\item{black_ind}{Number of black, independent poll respondents who ranked the given team in their top 3 favorites}
-\item{hispanic_ind}{Number of hispanic, independent poll respondents who ranked the given team in their top 3 favorites}
-\item{other_ind}{Number of independent poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites}
-\item{white_ind}{Number of white, independent poll respondents who ranked the given team in their top 3 favorites}
+\item{asian_ind}{Number of Asian, independent poll respondents who ranked the given team in their top 3 favorites}
+\item{black_ind}{Number of Black, independent poll respondents who ranked the given team in their top 3 favorites}
+\item{hispanic_ind}{Number of Hispanic, independent poll respondents who ranked the given team in their top 3 favorites}
+\item{other_ind}{Number of independent poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites}
+\item{white_ind}{Number of White, independent poll respondents who ranked the given team in their top 3 favorites}
\item{total_ind}{Total number of independent poll respondents who ranked the given team in their top 3 favorites}
-\item{asian_gop}{Number of asian, republican poll respondents who ranked the given team in their top 3 favorites}
-\item{black_gop}{Number of black, republican poll respondents who ranked the given team in their top 3 favorites}
-\item{hispanic_gop}{Number of hispanic, republican poll respondents who ranked the given team in their top 3 favorites}
-\item{other_gop}{Number of republican poll respondents who identified their race as "other" (not asian, black, hispanic, or white) and ranked the given team in their top 3 favorites}
-\item{white_gop}{Number of white, republican poll respondents who ranked the given team in their top 3 favorites}
+\item{asian_gop}{Number of Asian, republican poll respondents who ranked the given team in their top 3 favorites}
+\item{black_gop}{Number of Black, republican poll respondents who ranked the given team in their top 3 favorites}
+\item{hispanic_gop}{Number of Hispanic, republican poll respondents who ranked the given team in their top 3 favorites}
+\item{other_gop}{Number of republican poll respondents who identified their race as "other" (not Asian, Black, Hispanic, or White) and ranked the given team in their top 3 favorites}
+\item{white_gop}{Number of White, republican poll respondents who ranked the given team in their top 3 favorites}
\item{total_gop}{Total number of republican poll respondents who ranked the given team in their top 3 favorites}
\item{gop_percent}{Percent of fans (who ranked the team in their top 3 favorite NFL teams) who are republicans}
\item{dem_percent}{Percent of fans who are democrats}
\item{ind_percent}{Percent of fans who are independent}
-\item{white_percent}{Percent of fans who are white}
-\item{nonwhite_percent}{Percent of fans who are not white}
+\item{white_percent}{Percent of fans who are White}
+\item{nonwhite_percent}{Percent of fans who are not White}
}}
\source{
See \url{https://github.com/fivethirtyeight/data/tree/master/nfl-fandom/NFL_fandom_data-surveymonkey.csv}
diff --git a/man/nfl_suspensions.Rd b/man/nfl_suspensions.Rd
index e6bb1d8..d4bb2c1 100644
--- a/man/nfl_suspensions.Rd
+++ b/man/nfl_suspensions.Rd
@@ -9,7 +9,7 @@
\item{name}{first initial.last name}
\item{team}{team at time of suspension}
\item{games}{number of games suspended (one regular season = 16 games)}
- \item{category}{personal conduct, substance abuse, peformance enhancing drugs or in-game violence}
+ \item{category}{personal conduct, substance abuse, performance enhancing drugs or in-game violence}
\item{description}{description of suspension}
\item{year}{year of suspension}
\item{source}{news source}
diff --git a/man/ratings.Rd b/man/ratings.Rd
index f83d6b1..be2fcc9 100644
--- a/man/ratings.Rd
+++ b/man/ratings.Rd
@@ -43,7 +43,7 @@ ratings
}
\description{
The raw data behind the story
-"Al Gore’s New Movie Exposes The Big Flaw In Online Movie Ratings"
+"Al Gore's New Movie Exposes The Big Flaw In Online Movie Ratings"
\url{https://fivethirtyeight.com/features/al-gores-new-movie-exposes-the-big-flaw-in-online-movie-ratings/}.
}
\examples{
diff --git a/man/tarantino.Rd b/man/tarantino.Rd
index d72a247..ed3e7f0 100644
--- a/man/tarantino.Rd
+++ b/man/tarantino.Rd
@@ -21,5 +21,8 @@ tarantino
The raw data behind the story
"A Complete Catalog Of Every Time Someone Cursed Or Bled Out In A Quentin Tarantino Movie"
\url{https://fivethirtyeight.com/features/complete-catalog-curses-deaths-quentin-tarantino-films/}.
+An analysis using this data was contributed by Olivia Barrows, Jojo Miller, and Jayla Nakayama
+as a package vignette at
+\url{http://fivethirtyeight-r.netlify.com/articles/tarantino_swears.html}.
}
\keyword{datasets}
diff --git a/man/trump_approval_poll.Rd b/man/trump_approval_poll.Rd
index 6a54201..488ca83 100644
--- a/man/trump_approval_poll.Rd
+++ b/man/trump_approval_poll.Rd
@@ -16,8 +16,8 @@
\item{weight}{The weight fivethirtyeight gives the poll when determining approval ratings based on historical accuracy of the pollster}
\item{approve}{The percentage of respondents who approve of the president}
\item{disapprove}{The percentage of respondents who disapprove of the president}
-\item{adjusted_approve}{The percentage of respondets who approve of the president adjusted for systematic tendencies of the polling firm}
-\item{adjusted_disapprove}{The percentage of respondets who approve of the president adjusted for systematic tendencies of the polling firm}
+\item{adjusted_approve}{The percentage of respondents who approve of the president adjusted for systematic tendencies of the polling firm}
+\item{adjusted_disapprove}{The percentage of respondents who approve of the president adjusted for systematic tendencies of the polling firm}
\item{multiversions}{True if there are multiple versions of the poll, False if there are not}
\item{tracking}{TRUE if the poll was tracked, FALSE if not}
\item{url}{Poll result URL}
diff --git a/man/trump_twitter.Rd b/man/trump_twitter.Rd
index ff4fb5e..479fc77 100644
--- a/man/trump_twitter.Rd
+++ b/man/trump_twitter.Rd
@@ -20,6 +20,8 @@ trump_twitter
The raw data behind the story
"The World's Favorite Donald Trump Tweets"
\url{https://fivethirtyeight.com/features/the-worlds-favorite-donald-trump-tweets/}.
-Tweets posted on twitter by Donald Trump (@realDonaldTrump)
+Tweets posted on twitter by Donald Trump (@realDonaldTrump).
+An analysis using this data was contributed by Adam Spannbauer as a package vignette at
+\url{http://fivethirtyeight-r.netlify.com/articles/trump_twitter.html}.
}
\keyword{datasets}
diff --git a/man/trumpworld_polls.Rd b/man/trumpworld_polls.Rd
index 5c2b23c..25af9b1 100644
--- a/man/trumpworld_polls.Rd
+++ b/man/trumpworld_polls.Rd
@@ -4,7 +4,7 @@
\name{trumpworld_polls}
\alias{trumpworld_polls}
\title{What the World Thinks of Trump}
-\format{A data frame with 32 rows representng years and 40 variables:
+\format{A data frame with 32 rows representing years and 40 variables:
\describe{
\item{year}{Year the poll was conducted}
\item{avg}{The average percentage people who answered the poll question positively (support the president or have a favorable view of the U.S.)}
@@ -27,7 +27,7 @@
\item{philippines}{The percentage of people from the Philippines who answered the poll question positively}
\item{south_korea}{The percentage of people from South Korea who answered the poll question positively}
\item{vietnam}{The percentage of people from Vietnam who answered the poll question positively}
-\item{israel}{The percentage of people from Isreal who answered the poll question positively}
+\item{israel}{The percentage of people from Israel who answered the poll question positively}
\item{jordan}{The percentage of people from Jordan who answered the poll question positively}
\item{lebanon}{The percentage of people from Lebanon who answered the poll question positively}
\item{tunisia}{The percentage of people from Tunisia who answered the poll question positively}
@@ -45,7 +45,7 @@
\item{mexico}{The percentage of people from Mexico who answered the poll question positively}
\item{peru}{The percentage of people from Peru who answered the poll question positively}
\item{venezuela}{The percentage of people from Venezuela who answered the poll question positively}
-\item{question}{The item being polled. Specificially, whether respondents: 1) Have a favorable view of the U.S. or 2) Trust the U.S. President when it comes to foreign affairs}
+\item{question}{The item being polled. Specifically, whether respondents: 1) Have a favorable view of the U.S. or 2) Trust the U.S. President when it comes to foreign affairs}
}}
\source{
Pew Research Center \url{http://www.pewresearch.org/fact-tank/2017/07/17/9-charts-on-how-the-world-sees-trump/}
diff --git a/vignettes/NBA.html b/vignettes/NBA.html
index bb3bde8..0669240 100644
--- a/vignettes/NBA.html
+++ b/vignettes/NBA.html
@@ -12,7 +12,7 @@
-
+
2015 NBA player predictions analysis using the tidyverse
@@ -70,7 +70,7 @@
2015 NBA player predictions analysis using the tidyverse
The overall trend here is that NBA draft classes, on average, have shown an increase in mean projected plus-minus since 2003. Based on this analysis, 2015 is the best draft class since it has the highest mean projected plus-minus of any year. Another way to think of this is that 2015 was the most balanced based on this metric. This plot also shows that the draft classes have tended to be projected as having more impact on team success over time.
diff --git a/vignettes/bechdel.Rmd b/vignettes/bechdel.Rmd
index cf075b1..69a2262 100644
--- a/vignettes/bechdel.Rmd
+++ b/vignettes/bechdel.Rmd
@@ -1,6 +1,6 @@
---
title: "Bechdel analysis using the `tidyverse`"
-author: "Albert Y. Kim, Chester Ismay, and Jennifer Chunn"
+author: "Chester Ismay"
date: "`r Sys.Date()`"
output:
rmarkdown::html_vignette:
diff --git a/vignettes/bechdel.html b/vignettes/bechdel.html
index bb23fb7..39dfe5f 100644
--- a/vignettes/bechdel.html
+++ b/vignettes/bechdel.html
@@ -10,9 +10,9 @@
-
+
-
+
Bechdel analysis using the tidyverse
@@ -69,8 +69,8 @@
Bechdel analysis using the tidyverse
-
Albert Y. Kim, Chester Ismay, and Jennifer Chunn
-
2018-02-09
+
Chester Ismay
+
2018-02-11
@@ -276,7 +276,7 @@
Bechdel dummy is not a significant predictor of log(intgross_2013)color = binary)) +geom_point() +geom_smooth(method ="lm", se =FALSE)
-
+
gross_vs_budget_binary <-lm(log(intgross_2013) ~log(budget_2013) +factor(binary),
data = bechdel90_13)
tidy(gross_vs_budget_binary)
@@ -367,7 +367,7 @@
Bechdel dummy is not a significant predictor of log(roi_total)color = binary)) +geom_point() +geom_smooth(method ="lm", se =FALSE)
-
+
roi_vs_budget_binary <-lm(log(roi_total) ~log(budget_2013) +factor(binary),
data = bechdel90_13)
tidy(roi_vs_budget_binary)
@@ -465,7 +465,7 @@
Dollars Earned for Every Dollar Spent graphic
labs(title ="Dollars Earned for Every Dollar Spent", subtitle ="2013 dollars") +scale_fill_fivethirtyeight() +theme_fivethirtyeight()
-
+
Attempt to fully reproduce Dollars Earned for Every Dollar Spent plot using ggplot
ggplot(data = med_groups, mapping =aes(x = clean_test, y = median_roi,
fill = group)) +
@@ -486,7 +486,7 @@
theme(axis.text.x =element_text(vjust=1,angle=90)) +scale_y_continuous(labels = percent) +labs(x="Decade",y="Percentage Composition",title="How do the % of movies involving actors of color change by decade?",caption="Data From: FiveThirtyEight")
-
+
The percentage of movies that had actors of color was the highest in the period 2010-2014. Biopics that had actors of color were non existent during the period 1910-1930.
@@ -185,8 +185,8 @@
Type of Subjects covered
mutate(n=round(n,2)) %>%hchart("treemap", hcaes(x = type_of_subject, value = n, color = n)) %>%hc_title(text="Type of Subjects of Movies involving White Actors(%)")
-
-
+
+
Actors of Color
biopics %>%mutate(person_of_color=ifelse(person_of_color==0,"White","Person of Color")) %>%
@@ -197,8 +197,8 @@
Type of Subjects covered
mutate(n=round(n,2)) %>%hchart("treemap", hcaes(x = type_of_subject, value = n, color = n)) %>%hc_title(text="Type of Subjects of Movies involving Actors of Color(%)")
-
-
+
+
A side by side comparison
biopics %>%mutate(person_of_color =ifelse(person_of_color==0,"White","Person of Color")) %>%
@@ -212,7 +212,7 @@
Type of Subjects covered
facet_wrap(~person_of_color)+coord_flip()+labs(title="How do subject coverage differ in biopics involving white actors and actors of color?",caption="Data From : FiveThirtyEight",x="Type of Subject",y="%")
-
+
Within biopics that had actors of color, topics like Athelete,Activist,Singer,World Leader and Actor had a higher coverage than in biopics that had white actors.
@@ -234,7 +234,7 @@
Frequency of Movies Involving White Actors and Actors of Color
The vertical dashed line above indicates the year 1964, when the Civil Rights’ Act was passed. The number of biopics depicting colored persons went up in the 1970’s. The first successful African American themed sitcom was released in the year 1974 (“Good Times”).
@@ -253,7 +253,7 @@
Number of Biopics for each gender
subtitle="",caption="Data from FiveThirtyEight")+scale_x_continuous(breaks =seq(1920,2014,5))+theme(plot.title=element_text(size=18),axis.text.x =element_text(angle=90, vjust=1))
-
+
Change in the number of movies from previous years
@@ -280,7 +280,7 @@
Change in the number of movies from previous years
The change in the number of biopics that had male subjects shot up in 2014.
@@ -316,8 +316,8 @@
What kind of subjects do movies about male and female protaganists deal with
labs(y ="Biopics Involving Men", x ="Biopics Involving Women",text=element_text(size=10),
plot.title=element_text(hjust=0.5))+ggtitle("Relative Frequency of Subjects(Gender Wise)")
Topics that are close to the line indicate topics that have similar frequencies in both the sets of data. These topics include government,academic and activist. Topics that are far from this line are topics that are found frequently in one set but not the other.For example,a larger percentage of biopics that involved women,portrayed authors. By looking at the other side, topics like military had a higher percentage of coverage in biopics involving men than women.More the red color of the text, the more frequently the topic appears in biopics related to men.
@@ -341,7 +341,7 @@
Race and Gender
facet_grid(subject_sex~.)+theme(plot.title=element_text(size=18),axis.text.x =element_text(angle=90, vjust=1))+labs(caption="Data From FiveThirtyEight")
-
+
Most of the biopics depict White Americans followed by African Americans.
@@ -371,7 +371,7 @@
Distributions of earnings per year
subtitle="Inflation not taken into account(Diamond Point Represents Mean)",caption="Data From FiveThirtyEight")+facet_wrap(~subject_sex,ncol=1)+theme(axis.text.x =element_text(angle=90,vjust=1))
-
+
A large number of movies earned below $100M.As we progress through the 80’s, these numbers go higher , especially in the case of biopics based on men. The highest earning movie based on a female protaganist was released in 1964.This was the “Sound of Music” which earned approximately $163M.
diff --git a/vignettes/bob_ross.html b/vignettes/bob_ross.html
index e2c83eb..3494345 100644
--- a/vignettes/bob_ross.html
+++ b/vignettes/bob_ross.html
@@ -11,7 +11,7 @@
-
+
Bob Ross - Joy of Painting-
@@ -121,7 +121,7 @@
Bob Ross - Joy of Painting-
Jonathan Bouchet
-
2018-02-09
+
2018-02-11
@@ -177,7 +177,7 @@
Frequency
coord_flip() +
theme_fivethirtyeight() +
ggtitle('Features\'s appearance(%) through all episodes')
-
+
tree and trees features appear in more than 90% of all the paintings.
@@ -216,7 +216,7 @@
Episodes having the greatest number of features
geom_bar(stat='identity') +
coord_flip() + theme_fivethirtyeight() +
ggtitle(paste0('Paintings having more than ', cut_features,' features'))
-
+
Episodes distribution vs. their number of features
@@ -231,7 +231,7 @@
Episodes distribution vs. their number of features
geom_bar(stat='identity') +
geom_text(aes(label=label), position=position_dodge(width=0.9), vjust=-1,hjust=.5,size=2.5,color='red')+
theme_fivethirtyeight() + ggtitle('Distribution of paitings vs. \n number of features')
-
+
the mean number of features among all paintings is:
@@ -288,7 +288,7 @@
Result with all paintings for the first season
geom_edge_fan(aes(width=E(g1)$weight),alpha=.25,show.legend = FALSE) +
geom_node_point(size=6,color="red",alpha=1) +
geom_node_text(aes(label = name)) + theme_fivethirtyeight() + ggtitle('Features network of all paintings of season 1')
-
+
larger width indicate the frequency of this correlation
the most frequent conenction are tree | trees, tree | lake, lake | mountain, which makes sense as seen with the correlation plot.
diff --git a/vignettes/tarantino_swears.html b/vignettes/tarantino_swears.html
index 74a61a9..e8e7710 100644
--- a/vignettes/tarantino_swears.html
+++ b/vignettes/tarantino_swears.html
@@ -12,7 +12,7 @@
-
+
How Many Fucks Does Tarantino Give?
@@ -70,7 +70,7 @@
How Many Fucks Does Tarantino Give?
Olivia Barrows, Jojo Miller, and Jayla Nakayama
-
2018-02-09
+
2018-02-11
@@ -120,7 +120,7 @@
Total Swear Word Usage Over Tarantino’s Career
theme_fivethirtyeight() +labs(x ="Movie", y ="Swear Count", title ="Total Swear Word Usage Per Movie") +theme(axis.text.x =element_text(angle =45, hjust =1))
-
+
@@ -382,14 +382,14 @@
How Many Fucks Does Tarantino Actually Give?
theme_fivethirtyeight() +labs(x ="Minutes In", y ="Fucks Given", title ="Fucks Tarantino Gives Per Movie") +theme(axis.text.x =element_text(angle =45, hjust =1))
-
+
This can be further broken down to show what types of fucks Tarantino gives.
ggplot(data = tarantino_fuck, mapping =aes(x = minutes_in, fill = word)) +geom_histogram(binwidth =10, color ="white") +facet_wrap(~movie) +theme_fivethirtyeight() +labs(x ="Minutes In", y ="Fucks Given", title ="Fucks Tarantino Gives Per Movie (by Type)") +theme(axis.text.x =element_text(angle =45, hjust =1))
-
+
From this information, it is possible to see that in terms of fucks given:
Tarantino most often uses the variations ‘fuck’ and ‘fucking’
diff --git a/vignettes/trump_twitter.html b/vignettes/trump_twitter.html
index 0dc0356..1460f3b 100644
--- a/vignettes/trump_twitter.html
+++ b/vignettes/trump_twitter.html
@@ -12,7 +12,7 @@
-
+
Trump Twitter analysis using the tidyverse
@@ -70,7 +70,7 @@
In this dataset, the number of tweets decreased after November 2015 and drastically dropped off after March 2016. It is unclear if this is a result of actual decrease in tweeting frequency or a result of the data collection process.
diff --git a/vignettes/user_contributed_vignettes.R b/vignettes/user_contributed_vignettes.R
new file mode 100644
index 0000000..d908392
--- /dev/null
+++ b/vignettes/user_contributed_vignettes.R
@@ -0,0 +1,4 @@
+## ----install, eval=FALSE-------------------------------------------------
+# # install.packages("remotes")
+# remotes::install_github("rudeboybert/fivethirtyeight", build_vignettes = TRUE)
+
diff --git a/vignettes/user_contributed_vignettes.Rmd b/vignettes/user_contributed_vignettes.Rmd
new file mode 100644
index 0000000..361ebe3
--- /dev/null
+++ b/vignettes/user_contributed_vignettes.Rmd
@@ -0,0 +1,30 @@
+---
+title: "User-Contributed Vignettes"
+author: "Chester Ismay"
+date: "`r Sys.Date()`"
+output:
+ rmarkdown::html_vignette:
+ df_print: kable
+vignette: |
+ %\VignetteIndexEntry{User-Contributed Vignettes}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+Due to CRAN space limitations on packages, user-contributed vignettes that walk through different analyses using the data sets in the `fivethirtyeight` package are linked below in this "vignette of vignettes." You can find both the R Markdown file needed to generate the file and also a link to the HTML vignette on the package website at . The vignette title links to the HTML version and the (Rmd) immediately following links to the R Markdown source. We encourage others to share their analyses using the `fivethirtyeight` data sets.
+
+The developmental version of the package stored on GitHub contains all of the vignettes so if you'd like to build the package locally, first install the [`remotes` package](https://CRAN.R-project.org/package=remotes) and then install the package via
+
+```{r install, eval=FALSE}
+# install.packages("remotes")
+remotes::install_github("rudeboybert/fivethirtyeight", build_vignettes = TRUE)
+```
+
+## Analyses
+
+- [Looking at the Biopics of Hollywood](http://fivethirtyeight-r.netlify.com/articles/biopics.html) by Pradeep Adhokshaja [(Rmd)](https://raw.githubusercontent.com/rudeboybert/fivethirtyeight/master/vignettes/biopics.Rmd)
+- [Bob Ross - Joy of Painting](http://fivethirtyeight-r.netlify.com/articles/bob_ross.html) by Jonathan Bouchet [(Rmd)](https://raw.githubusercontent.com/rudeboybert/fivethirtyeight/master/vignettes/bob_ross.Rmd)
+- [Gender in Comic Books](http://fivethirtyeight-r.netlify.com/articles/comics_gender.html) by Jonathan Bouchet [(Rmd)](https://raw.githubusercontent.com/rudeboybert/fivethirtyeight/master/vignettes/comics_gender.Rmd)
+- [2015 NBA player predictions analysis using the `tidyverse`](http://fivethirtyeight-r.netlify.com/articles/nba.html) by G. Elliott Morris (with support from Chester Ismay) [(Rmd)](https://raw.githubusercontent.com/rudeboybert/fivethirtyeight/master/vignettes/NBA.Rmd)
+- [How Many Fucks Does Tarantino Give?](http://fivethirtyeight-r.netlify.com/articles/tarantino_swears.html) by Olivia Barrows, Jojo Miller, and Jayla Nakayama [(Rmd)](https://raw.githubusercontent.com/rudeboybert/fivethirtyeight/master/vignettes/tarantino_swears.Rmd)
+- [Trump Twitter analysis using the `tidyverse`](http://fivethirtyeight-r.netlify.com/articles/trump_twitter.html) by Adam Spannbauer (with support from Jennifer Chunn) [(Rmd)](https://raw.githubusercontent.com/rudeboybert/fivethirtyeight/master/vignettes/trump_twitter.Rmd)
diff --git a/vignettes/user_contributed_vignettes.html b/vignettes/user_contributed_vignettes.html
new file mode 100644
index 0000000..fa3865a
--- /dev/null
+++ b/vignettes/user_contributed_vignettes.html
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+User-Contributed Vignettes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
User-Contributed Vignettes
+
Chester Ismay
+
2018-02-11
+
+
+
+
Due to CRAN space limitations on packages, user-contributed vignettes that walk through different analyses using the data sets in the fivethirtyeight package are linked below in this “vignette of vignettes.” You can find both the R Markdown file needed to generate the file and also a link to the HTML vignette on the package website at https://fivethirtyeight-r.netlify.com. The vignette title links to the HTML version and the (Rmd) immediately following links to the R Markdown source. We encourage others to share their analyses using the fivethirtyeight data sets.
+
The developmental version of the package stored on GitHub contains all of the vignettes so if you’d like to build the package locally, first install the remotes package and then install the package via