-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathREADME.Rmd
124 lines (93 loc) · 3.96 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# tidytuesdayR <a href="https://dslc-io.github.io/tidytuesdayR/"><img src="man/figures/logo.png" align="right" height="138" alt="tidytuesdayR website" /></a>
<!-- badges: start -->
[](https://CRAN.R-project.org/package=tidytuesdayR)
[](https://github.com/dslc-io/tidytuesdayR/actions)
[](https://app.codecov.io/github/dslc-io/tidytuesdayR?branch=main)
[](https://cran.r-project.org/package=tidytuesdayR)
[](https://opensource.org/licenses/MIT)
[](https://github.com/dslc-io/tidytuesdayR/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
tidytuesdayR makes it easy to participate in the weekly [`#TidyTuesday`](https://tidytues.day/) project by providing functions to quickly import data posted to the [Tidy Tuesday repository](https://github.com/rfordatascience/tidytuesday).
## Installation
This package is (usually) available on CRAN via:
``` r
install.packages("tidytuesdayR")
```
To get the latest in-development features, install the development version from GitHub:
``` r
#install.packages("pak")
pak::pak("dslc-io/tidytuesdayR")
```
## Usage
There are currently two methods to access the data from the respository.
### Load the Data!
The simplest way is to use the `tt_load()` function. This
function has accepts two types of inputs to determine which data to
grab. It can be a date as a string in the YYYY-MM-DD format like below.
``` r
library(tidytuesdayR)
tt_data <- tt_load("2019-01-15")
```
Or the function can accept the year as the first argument, and which
week of the year as the second.
``` r
tt_data <- tt_load(2019, week=3)
```
`tt_load()` naively downloads *all* the data that is available and
stores them in the resulting `tt_data` object. To access the data, use
the `$` or `[[` notation and the name of the dataset.
``` r
tt_data$agencies
tt_data[["agencies"]]
```
To view the readme, either print the `tt_data` object or use the `readme()`
function. When you print the `tt_data` object, you also get the available
datasets names printed in the console.
``` r
readme(tt_data)
print(tt_data)
```
```
## Available Datasets:
## agencies
## launches
##
```
### TidyTemplate
As part of the goal of making participating in #TidyTuesday easier, {tidytuesdayR} now also provides a template!
To use it, just use the `use_tidytemplate()` function!
By default, the template will assume to be using the most recent TidyTuesday.
However, you can pass a date object or character string in YYYY-MM-DD format
defining a different date you want to use. If you don't recall the exact date,
no worries, you can use the `tt_available()` function to figure out which date
and get the date to use!
```r
## this weeks TidyTuesday!
tidytuesdayR::use_tidytemplate()
## TidyTuesday from Week 42 of 2019
tidytuesdayR::use_tidytemplate(refdate = "2019-10-15")
```
Additionally, by default the template will create the new file in your working
directory, using the "YYYY_MM_DD" format per good practices.
However, if you are so inclined, you can rename it to whatever you wish.
```r
tidytuesdayR::use_tidytemplate(name = "My Super Great TidyTuesday.Rmd")
```
## Contributing
Please note that the ‘tidytuesdayR’ project is released with a
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to
this project, you agree to abide by its terms.