-
Notifications
You must be signed in to change notification settings - Fork 79
/
100k-rows.Rmd
57 lines (50 loc) · 1.2 KB
/
100k-rows.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
---
title: "100k Rows"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
set.seed(5)
options(reactable.static = TRUE)
```
```{r}
library(reactable)
rows <- 100000
dates <- seq.Date(as.Date("2018-01-01"), as.Date("2018-12-01"), "day")
data <- data.frame(
index = seq_len(rows),
date = sample(dates, rows, replace = TRUE),
city = sample(names(precip), rows, replace = TRUE),
state = sample(rownames(USArrests), rows, replace = TRUE),
temp = round(runif(rows, 0, 100), 1),
stringsAsFactors = FALSE
)
reactable(
data,
filterable = TRUE,
searchable = TRUE,
minRows = 10,
highlight = TRUE,
columns = list(
state = colDef(
html = TRUE,
cell = JS('function(cell) {
return `<a href="https://wikipedia.org/wiki/${cell.value}">${cell.value}</a>`
}')
)
),
details = colDef(
html = TRUE,
details = JS("function(rowInfo) {
return `Details for row: ${rowInfo.index}` +
`<pre>${JSON.stringify(rowInfo.values, null, 2)}</pre>`
}")
)
)
```
```{css echo=FALSE}
/* rmarkdown html documents */
.main-container {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
```