This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathREADME.Rmd
167 lines (114 loc) · 4.85 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
# Discovering good data packages
[![DOI: 10.5281/zenodo.47223](https://zenodo.org/badge/doi/10.5281/zenodo.1095831.svg)](https://doi.org/10.5281/zenodo.1095831)
### Project participants:
- Andy Teucher [\@ateucher](https://github.com/ateucher)
- Richie Cotton [\@richierocks](https://github.com/richierocks)
- Claudia Vitolo [\@cvitolo](https://github.com/cvitolo)
- Jakub Nowosad [\@Nowosad](https://github.com/Nowosad)
- Joe Stachelek [\@jsta](https://github.com/jsta)
Most of us are involved in teaching R in some way, and it is always a struggle to find suitable datasets with which to teach, especially across domain expertise. There are many packages that have data, but finding them and knowing what is in them is a struggle due to inadequate documentation.
## Goals:
1. Make it easy to discover suitable data
2. Write some guidance on documenting data in packages
## Deliverables:
1. Google Doc which describes best practices for documentation.
Checklist of things to document.
Make sure your documentation answers as many of these questions as possible.
- What does the data represent?
- What format is the data in?
- How big is the dataset?
- Where does the come from?
- How has the data been processed?
- What does the data look like?
- How do you analyze the data?
- Where is this data used?
- Is there a paper, or other external resource discussing this dataset?
2. A patch for `usethis::use_readme_rmd()` to display datasets in package README files.
3. A [flexdashboard](https://ropenscilabs.github.io/data-packages) with a searchable table that shows metadata on datasets from many CRAN packages. It has information for over 4000 datasets.
![](inst/screenshots/pkg.png)
![](inst/screenshots/datasets.png)
![](inst/screenshots/rdfiles.png)
## The state of data on CRAN
* [List CRAN packages with data](R/get-pkgs-with-data-dir.R)
* [Parsing DESCRIPTION files](R/parse_description.R)
* [Parsing Rd files](R/get_metacran.R)
* *Installing and loading packages*
## What makes a good data package?
https://docs.google.com/document/d/1xhJmt0v4p49jpwINNak9N7AMMb5yohTwwNOXH8WzqqQ/edit?usp=sharing
## Twitter Bot
https://twitter.com/rstatsdata
![](inst/screenshots/tweetbot.png)
## Graphs
```{r, echo=FALSE, message=FALSE, warning=FALSE, fig.width=8}
library(forcats)
library(tidyverse)
theme_set(theme_bw())
data_cran <- read_rds("data/description_metadata.rds") %>%
mutate(is_data_package = factor(is_data_package, levels=c("FALSE", "TRUE"), labels=c("Non-data packages", "Data packages")))
ggplot(data_cran, aes(is_data_package)) +
geom_bar() +
labs(x=NULL)
ggplot(data_cran, aes(LazyData)) +
geom_bar() +
facet_wrap(~is_data_package) +
theme(axis.text.x=element_text(angle = 90, hjust = 1))
ggplot(data_cran, aes(BugReports_is_not_na)) +
geom_bar() +
facet_wrap(~is_data_package) +
labs(x = "Is there an BugReports in the package description?")
ggplot(data_cran, aes(URL_is_not_na)) +
geom_bar() +
facet_wrap(~is_data_package) +
labs(x = "Is there an URL in the package description?")
```
```{r, echo=FALSE, fig.height=8}
# ggplot(data_cran, aes(License)) +
# geom_bar() +
# coord_flip() +
# facet_wrap(~is_data_package)
```
```{r, echo=FALSE, fig.height=14}
df <- data_cran %>%
select(is_data_package, License) %>%
group_by(is_data_package, License) %>%
summarise(n=n())
df_wide <- df %>%
spread(is_data_package, n) %>%
mutate(`Non-data packages` = ifelse(is.na(`Non-data packages`), 0, `Non-data packages`),
`Data packages` = ifelse(is.na(`Data packages`), 0, `Data packages`)) %>%
mutate(diff=`Data packages`-`Non-data packages`)
ggplot(df_wide, aes(fct_reorder(License, diff), diff)) +
geom_col() +
coord_flip() +
labs(x="License", y="<--- Non-data packages --------- Data packages --->") +
theme(axis.text.y = element_text(size=8))
```
```{r fig.height=4, fig.width=8, echo=FALSE, fig.align='center'}
df_ts <- data_cran %>%
mutate(year = as.integer(strftime(data_cran$Published, format = "%Y"))) %>%
group_by(year, is_data_package) %>%
summarise(number = n())
# devtools::install_github("karthik/wesanderson")
library(wesanderson)
ggplot(df_ts, aes(year, number, color = is_data_package)) +
geom_point() +
scale_y_log10(breaks = c(10, 100, 1000)) +
scale_x_continuous(breaks = seq(2005, 2017, by=3)) +
scale_color_manual(name=NULL, values = wes_palette("Royal1"))
```
## Potential Future Work
### Additional Data Sources
* Crawl Biocondunctor
* Examine `inst/extdata` folders
### Additional Package Stats
* Use Github URLs to pull geo-location of package maintainers
### Quality Assessment
* Scoring the quality of data in a package
* Creating badges to advertise data quality
* Contact package authors with data quality deficiencies