forked from vincentarelbundock/Rdatasets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.Rmd
114 lines (91 loc) · 2.78 KB
/
index.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
---
title: "Available datasets"
output: rmarkdown::html_document
editor_options:
chunk_output_type: console
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
options(DT.warn.size = FALSE)
library(DT)
library(dplyr)
tablify <- function(x, ...) {
datatable(
x,
style = "bootstrap4",
rownames = FALSE,
options = list(
pageLength = 10,
lengthMenu = c(10, 100, 500, 1000),
# fixedHeader = TRUE,
# paging = FALSE,
autoWidth = TRUE,
columnDefs = list(
# Unfortunately widths are all over the place
# due to some very long dataset names
list(targets = 0, width = '5%'),
list(targets = 1, width = '5%'),
list(targets = 2, width = '30%'),
list(targets = 3, searchable = FALSE),
list(targets = 4, width = '10%'),
list(targets = 5, width = '10%')
)
),
filter = "top",
...
)
}
xdat <- read.csv(here::here("datasets.csv")) %>%
mutate(
Package = factor(Package),
CSV = paste0('<a href="', CSV, '">CSV</a>'),
#CSV = purrr::map(CSV, htmltools::HTML),
Doc = paste0('<a href="', Doc, '">Doc</a>'),
#Doc = purrr::map(Doc, htmltools::HTML),
Link = paste(CSV, "<br/>", Doc),
Link = purrr::map(Link, htmltools::HTML)
) %>%
select(Package, Item, Title, Link, Rows, Cols, order(names(.)), -CSV, -Doc)
```
This is a slightly adapted version of [Vincent's very handy project](https://github.com/vincentarelbundock/Rdatasets) with some added packages and a couple of tweaks to the table.
Please note that not all datasets could be parsed correctly, with some type-specific issues for non-`data.frame` datasets such as `plyr::ozone` which is an `array` with dimensions `24 24 72`.
# Datasets {.tabset}
## All
This shows all `r nrow(xdat)` datasets.
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
tablify(xdat)
```
## Small
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
xdat_subset <- xdat %>%
filter(Rows <= 100, Cols <= 10)
```
This subset contains `r nrow(xdat_subset)` datasets with `Rows <= 100 & Cols <= 10`.
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
xdat_subset %>%
tablify()
```
## High dimensional
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
xdat_subset <- xdat %>%
filter(Cols > Rows)
```
This subset contains `r nrow(xdat_subset)` datasets with `Cols > Rows`.
Defining high-dimensionality is hard but this seems like a place to start.
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
xdat_subset %>%
tablify()
```
## Large
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
xdat_subset <- xdat %>%
filter(Rows >= 10000)
```
This subset contains `r nrow(xdat_subset)` datasets with `Rows >= 10000`.
```{r, messages=FALSE, warnings=FALSE, echo=FALSE}
xdat_subset %>%
tablify()
```