Description Usage Format Source See Also Examples
The raw data behind the story "The Battle For Riddler Nation, Round 2" https://fivethirtyeight.com/features/the-battle-for-riddler-nation-round-2/. Analysis of the submitted solutions can be found at: https://fivethirtyeight.com/features/how-much-should-you-bid-for-that-painting/
1 |
A data frame with 932 rows representing submissions and 11 variables:
Number of troops out of 100 send to castle 1
Number of troops out of 100 send to castle 2
Number of troops out of 100 send to castle 3
Number of troops out of 100 send to castle 4
Number of troops out of 100 send to castle 5
Number of troops out of 100 send to castle 6
Number of troops out of 100 send to castle 7
Number of troops out of 100 send to castle 8
Number of troops out of 100 send to castle 9
Number of troops out of 100 send to castle 10
Why did you choose your troop deployment?
See https://github.com/fivethirtyeight/data/tree/master/riddler-castles
1 2 3 4 5 6 7 | # To convert data frame to tidy data (long) format, run
library(dplyr)
library(tidyr)
library(stringr)
riddler_castles_tidy<-riddler_castles2 %>%
pivot_longer(castle1:castle10, names_to = "castle" , values_to = "soldiers") %>%
mutate(castle = as.numeric(str_replace(castle, "castle","")))
|
Some larger datasets need to be installed separately, like senators and
house_district_forecast. To install these, we recommend you install the
fivethirtyeightdata package by running:
install.packages('fivethirtyeightdata', repos =
'https://fivethirtyeightdata.github.io/drat/', type = 'source')
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.