Title: | Access the Weekly 'TidyTuesday' Project Dataset |
---|---|
Description: | 'TidyTuesday' is a project by the 'Data Science Learning Community' in which they post a weekly dataset in a public data repository (<https://github.com/rfordatascience/tidytuesday>) for people to analyze and visualize. This package provides the tools to easily download this data and the description of the source. |
Authors: | Jon Harmon [aut, cre] , Ellis Hughes [aut], Thomas Mock [ctb], Data Science Learning Community [dtc] |
Maintainer: | Jon Harmon <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.2.9000 |
Built: | 2024-10-27 05:35:44 UTC |
Source: | https://github.com/dslc-io/tidytuesdayr |
Identify the most recent 'TidyTuesday' date relative to a specified date.
last_tuesday(date = today(tzone = "America/New_York"))
last_tuesday(date = today(tzone = "America/New_York"))
date |
A date as a date object or character string in |
The TidyTuesday date in the same week as the specified date, using Monday as the start of the week.
last_tuesday() # get last Tuesday relative to today's date last_tuesday("2020-01-01") # get last Tuesday relative to a specified date
last_tuesday() # get last Tuesday relative to today's date last_tuesday("2020-01-01") # get last Tuesday relative to a specified date
In tidytuesdayR there are nice print methods for the objects that were used to download and store the data from the TidyTuesday repo. They will always print the available datasets/files. If there is a readme available, it will try to display the TidyTuesday readme.
## S3 method for class 'tt_data' print(x, ...) ## S3 method for class 'tt' print(x, ...)
## S3 method for class 'tt_data' print(x, ...) ## S3 method for class 'tt' print(x, ...)
x |
a tt_data or tt object |
... |
further arguments passed to or from other methods. |
used to show readme and list names of available datasets
x
, invisibly.
tt <- tt_load_gh("2019-01-15") print(tt) tt_data <- tt_download(tt, files = "All") print(tt_data)
tt <- tt_load_gh("2019-01-15") print(tt) tt_data <- tt_download(tt, files = "All") print(tt_data)
Readme HTML maker and Viewer
readme(tt)
readme(tt)
tt |
tt_data object for printing |
Null, invisibly. Used to show readme of the downloaded TidyTuesday dataset in the Viewer.
if (rate_limit_check(quiet = TRUE) > 30) { tt_output <- tt_load_gh("2019-01-15") readme(tt_output) }
if (rate_limit_check(quiet = TRUE) > 30) { tt_output <- tt_load_gh("2019-01-15") readme(tt_output) }
The TidyTuesday project is a constantly growing repository of data sets. Knowing what type of data is available for each week requires going to the source. However, one of the hallmarks of 'tidytuesdayR' is that you never have to leave your R console. These functions were created to help maintain this philosophy.
tt_available(auth = gh::gh_token()) tt_datasets(year, auth = gh::gh_token())
tt_available(auth = gh::gh_token()) tt_datasets(year, auth = gh::gh_token())
auth |
A GitHub token. See |
year |
What year of TidyTuesday to use |
To find out the available datasets for a specific year, the user
can use the function tt_datasets()
. This function will either populate the
Viewer or print to console all the available data sets and the week/date
they are associated with.
To get the whole list of all the data sets ever released by TidyTuesday, the
function tt_available()
was created. This function will either populate the
Viewer or print to console all the available data sets ever made for
TidyTuesday.
tt_available()
returns a tt_dataset_table_list
, which is a
list of tt_dataset_table
. This class has special printing methods to show
the available data sets.
tt_datasets()
returns a tt_dataset_table
object. This class has
special printing methods to show the available datasets for the year.
# check to make sure there are requests still available if (rate_limit_check(quiet = TRUE) > 30) { ## show data available from 2018 tt_datasets(2018) ## show all data available ever tt_available() }
# check to make sure there are requests still available if (rate_limit_check(quiet = TRUE) > 30) { ## show data available from 2018 tt_datasets(2018) ## show all data available ever tt_available() }
Download all or specific files identified in a TidyTuesday dataset.
tt_download(tt, files = "All", ..., auth = gh::gh_token())
tt_download(tt, files = "All", ..., auth = gh::gh_token())
tt |
A |
files |
Which file names to download. Default "All" downloads all files for the specified week. |
... |
Additional parameters to pass to the parsing functions. Note: These arguments will be passed for all filetypes. |
auth |
A GitHub token. See |
A list of tibbles from the downloaded files.
# Get the list of files for a week. tt_output <- tt_load_gh("2019-01-15") # Download a specific file. agencies <- tt_download(tt_output, files = "agencies.csv")
# Get the list of files for a week. tt_output <- tt_load_gh("2019-01-15") # Download a specific file. agencies <- tt_download(tt_output, files = "agencies.csv")
Download an actual data file from the TidyTuesday github repository.
tt_download_file(tt, x, ..., auth = gh::gh_token())
tt_download_file(tt, x, ..., auth = gh::gh_token())
tt |
A |
x |
Index or name of file to download. |
... |
Additional parameters to pass to the parsing functions. Note: These arguments will be passed for all filetypes. |
auth |
A GitHub token. See |
tibble containing the contents of the file downloaded from git
tt_gh <- tt_load_gh("2019-01-15") agencies <- tt_download_file(tt_gh, 1) launches <- tt_download_file(tt_gh, "launches.csv")
tt_gh <- tt_load_gh("2019-01-15") agencies <- tt_download_file(tt_gh, 1) launches <- tt_download_file(tt_gh, "launches.csv")
Load TidyTuesday data from Github
tt_load(x, week = NULL, files = "All", ..., auth = gh::gh_token())
tt_load(x, week = NULL, files = "All", ..., auth = gh::gh_token())
x |
The date of data to pull (in "YYYY-MM-dd" format), or the four-digit year as a number. |
week |
Which week number to use within a given year. Only used when |
files |
Which file names to download. Default "All" downloads all files for the specified week. |
... |
Additional parameters to pass to the parsing functions. Note: These arguments will be passed for all filetypes. |
auth |
A GitHub token. See |
tt_data
object, which contains data that can be accessed via $
,
and the readme for the week's TidyTuesday, which can be viewed by printing
the object or calling readme()
.
tt_output <- tt_load("2019-01-15") tt_output agencies <- tt_output$agencies
tt_output <- tt_load("2019-01-15") tt_output agencies <- tt_output$agencies
Pulls the readme and URLs of the data from the TidyTuesday github folder based on the date provided
tt_load_gh(x, week = NULL, auth = gh::gh_token())
tt_load_gh(x, week = NULL, auth = gh::gh_token())
x |
The date of data to pull (in "YYYY-MM-dd" format), or the four-digit year as a number. |
week |
Which week number to use within a given year. Only used when |
auth |
A GitHub token. See |
A tt
object. This contains the files available for the week,
readme html, and the date of the TidyTuesday.
# check to make sure there are requests still available if (rate_limit_check(quiet = TRUE) > 30) { tt_gh <- tt_load_gh("2019-01-15") ## readme attempts to open the readme for the weekly dataset readme(tt_gh) agencies <- tt_download( tt_gh, files = "agencies.csv" ) }
# check to make sure there are requests still available if (rate_limit_check(quiet = TRUE) > 30) { tt_gh <- tt_load_gh("2019-01-15") ## readme attempts to open the readme for the weekly dataset readme(tt_gh) agencies <- tt_download( tt_gh, files = "agencies.csv" ) }
printing utilities for showing the available datasets for a specific year or all time
## S3 method for class 'tt_dataset_table' print(x, ..., is_interactive = interactive()) ## S3 method for class 'tt_dataset_table_list' print(x, ..., is_interactive = interactive())
## S3 method for class 'tt_dataset_table' print(x, ..., is_interactive = interactive()) ## S3 method for class 'tt_dataset_table_list' print(x, ..., is_interactive = interactive())
x |
an object used to select a method. |
... |
further arguments passed to or from other methods. |
is_interactive |
Whether the function is being used interactively. |
x
, invisibly
# check to make sure there are requests still available if (rate_limit_check(quiet = TRUE) > 30) { available_datasets_2018 <- tt_datasets(2018) print(available_datasets_2018) all_available_datasets <- tt_available() print(all_available_datasets) }
# check to make sure there are requests still available if (rate_limit_check(quiet = TRUE) > 30) { available_datasets_2018 <- tt_datasets(2018) print(available_datasets_2018) all_available_datasets <- tt_available() print(all_available_datasets) }
Use the tidytemplate Rmd for starting your analysis with a leg up for processing
use_tidytemplate( name = NULL, open = rlang::is_interactive(), refdate = today(), ignore = FALSE )
use_tidytemplate( name = NULL, open = rlang::is_interactive(), refdate = today(), ignore = FALSE )
name |
A name for your generated TidyTuesday analysis Rmd, such as "My_TidyTuesday.Rmd". |
open |
Open the newly created file for editing? Happens in RStudio, if
applicable, or via |
refdate |
Date to use as reference to determine which TidyTuesday to use for the template. Either date object or character string in YYYY-MM-DD format. |
ignore |
Should the newly created file be added to |
A logical vector indicating whether the file was created or modified, invisibly.
use_tidytemplate(name = "My_Awesome_TidyTuesday.Rmd")
use_tidytemplate(name = "My_Awesome_TidyTuesday.Rmd")