Visualizing Big Data with Trelliscope in R
Ryan Hafen
Author, TrelliscopeJS
by_symbol
# A tibble: 500 x 4
symbol data last_close panel
<chr> <list> <dbl> <list>
1 TWOU <tibble [252 × 7]> 30.2 <S3: plotly>
2 JOBS <tibble [252 × 7]> 33.8 <S3: plotly>
3 ABMD <tibble [252 × 7]> 113 <S3: plotly>
4 ACHC <tibble [252 × 7]> 33.1 <S3: plotly>
5 ACAD <tibble [252 × 7]> 28.8 <S3: plotly>
6 ACIW <tibble [252 × 7]> 18.2 <S3: plotly>
7 ATVI <tibble [252 × 7]> 36.1 <S3: plotly>
8 ADBE <tibble [252 × 7]> 103 <S3: plotly>
9 AAAP <tibble [252 × 7]> 26.8 <S3: plotly>
10 AEIS <tibble [252 × 7]> 54.8 <S3: plotly>
# ... with 490 more rows
stocks_meta
# A tibble: 500 x 6
symbol company market_cap ipo_year sector industry
<chr> <chr> <dbl> <dbl> <chr> <chr>
1 AAPL Apple Inc. 791730000000 1980 Technol… Computer Manufa…
2 GOOGL Alphabet Inc. 668500000000 NA Technol… Computer Softwa…
3 GOOG Alphabet Inc. 657890000000 2004 Technol… Computer Softwa…
4 MSFT Microsoft Corporation 568960000000 1986 Technol… Computer Softwa…
5 FB Facebook, Inc. 490030000000 2012 Technol… Computer Softwa…
6 AMZN Amazon.com, Inc. 459430000000 1997 Consume… Catalog/Special…
# ... with 494 more rows
library(dplyr)
by_symbol <- left_join(by_symbol, stocks_meta)
by_symbol <- mutate(by_symbol, volume_stats = map(data, function(x) { data_frame(min_volume = min(x$volume), max_volume = max(x$volume)) }))
by_symbol %>% select(symbol, data, volume_stats) %>% head(3)
# A tibble: 3 x 3
symbol data volume_stats
<chr> <list> <list>
1 TWOU <tibble [252 × 8]> <tibble [1 × 2]>
2 JOBS <tibble [252 × 8]> <tibble [1 × 2]>
3 ABMD <tibble [252 × 8]> <tibble [1 × 2]>
by_symbol$stats[[1]]
# A tibble: 1 x 2
min_volume max_volume
<dbl> <dbl>
1 139800 1843900
cog()
function allows specification of cognostic behaviors in the viewer:
desc
: a free text descriptiondefault_label
: should this cognostic be shown by default in the viewer?by_symbol <- mutate(by_symbol,
company = cog(
val = company,
desc = "company name",
default_label = TRUE
)
)
Visualizing Big Data with Trelliscope in R