The {datardis} package
[This article was first published on Jonathan Kitt, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Install the package
The {datardis} package is available on CRAN:
install.packages("datardis")
The datasets
As of today, the {datardis} package (version 0.0.3) contains six datasets :
List of Doctor Who episodes from the revived era (since 2005)
List of directors for Doctor Who episodes
List of writers for Doctor Who episodes
List of Torchwood episodes
List of directors for Torchwood episodes
List of writers for Torchwood episodes
Accessing the datasets
To access the datasets, use the following commands:
# Load the package library(datardis) # List of Dr Who episodes drwho_episodes # List of Dr Who directors drwho_directors # List of Dr Who writers drwho_writers # List of Torchwood episodes torchwood_episodes # List of Torchwood directors torchwood_directors # List of Torchwood writers torchwood_writers
Exploring the datasets
List of Dr Who episodes
To view the dataset content, use the glimpse()
function:
# Load the tidyverse library(tidyverse) # View the dataset content glimpse(drwho_episodes)
Rows: 175 Columns: 12 $ era <chr> "revived", "revived", "revived", "revived", "revived",… $ season_number <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, … $ serial_title <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… $ story_number <chr> "157", "158", "159", "160a", "160b", "161", "162", "16… $ episode_number <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, NA, 1, 2, 3… $ episode_title <chr> "Rose", "The End of the World", "The Unquiet Dead", "A… $ type <chr> "episode", "episode", "episode", "episode", "episode",… $ first_aired <date> 2005-03-26, 2005-04-02, 2005-04-09, 2005-04-16, 2005-… $ production_code <chr> "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8"… $ uk_viewers <dbl> 10.81, 7.97, 8.86, 7.63, 7.98, 8.63, 8.01, 8.06, 7.11,… $ rating <dbl> 76, 76, 80, 82, 81, 84, 81, 83, 84, 85, 82, 86, 89, 84… $ duration <dbl> 45, 44, 44, 45, 42, 45, 44, 45, 45, 45, 45, 45, 45, 60…
Who wrote the most Dr Who episodes?
To find out who wrote the most Dr Who episodes, use the following code:
drwho_writers |> count(writer, sort = TRUE) |> head(5)
# A tibble: 5 × 2 writer n <chr> <int> 1 Steven Moffat 45 2 Russell T Davies 31 3 Chris Chibnall 29 4 Mark Gatiss 9 5 Toby Whithouse 7
To leave a comment for the author, please follow the link and comment on their blog: Jonathan Kitt.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.