Learn R Programming

⚠️There's a newer version (0.2.6) of this package.Take me there.

trelliscopejs R Package

Trelliscope is a scalable, flexible, interactive approach to visualizing data. The trelliscopejs R package provides methods that make it easy to create a Trelliscope display specification for the Trelliscope JavaScript library trelliscopejs-lib. High-level functions are provided for creating displays from within dplyr (via summarise()) or ggplot2 (via facet_trelliscope()) workflows. Low-level functions are also provided for creating new interfaces.

Note that this package, trelliscopejs is the successor of the [trelliscope] package which is available on CRAN and is part of the DeltaRho project. Eventually the trelliscopejs package will replace trelliscope and plug in to the DeltaRho ecosystem as well.

Install

devtools::install_github("hafen/trelliscopejs")

Demos

Examples

The examples below are minimal. Please see the package vignettes for more.

ggplot

library(trelliscopejs)
library(ggplot2)
library(gapminder)

qplot(year, lifeExp, data = gapminder) +
  xlim(1948, 2011) + ylim(10, 95) + theme_bw() +
  facet_trelliscope(~ country + continent, nrow = 2, ncol = 7, width = 300)

tidyverse

library(trelliscopejs)
library(tidyverse)
library(rbokeh)
library(gapminder)

# nest gapminder data by country
by_country <- gapminder %>%
  group_by(country, continent) %>%
  nest()

# add in a plot column with map_plot
by_country <- by_country %>% mutate(
  panel = map_plot(data,
    ~ figure(xlim = c(1948, 2011), ylim = c(10, 95), width = 300, tools = NULL) %>%
        ly_points(year, lifeExp, data = .x, hover = .x)
  ))

# plot it
by_country %>%
  trelliscope("gapminder", nrow = 2, ncol = 7)

Copy Link

Version

Install

install.packages('trelliscopejs')

Monthly Downloads

689

Version

0.1.11

License

BSD_3_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Ryan Hafen

Last Published

February 1st, 2021

Functions in trelliscopejs (0.1.11)

facet_trelliscope

Facet Trelliscope
by_row_cog

Apply a function to each row of a data frame and return a data frame with new column of cognostics
img_panel

Cast a vector of URLs pointing to images as an image panel source
mpg_labels

Labels for ggplot2 "mpg" data
Trelliscope-shiny

Shiny bindings for Trelliscope
panel

Panel Wrapper Function Wrapper function to specify a plot object for a panel for use in dplyr summarise()
as_cognostics

Cast a data frame as a cognostics data frame
by_row_plot

Apply a function to each row of a data frame and return a data frame with new column of plots
update_display_list

Update Trelliscope app display list file
cog

Cast Column as a Cognostic
write_cognostics

Write cognostics data for a display in a Trelliscope app
cog_href

Href Cognostic
panels

Panels Wrapper Function
cogs

Cogs Wrapper Function
+.gg

Add method for gg / facet_trelliscope
prepare_display

Set up all auxilliary files needed for a Trelliscope app
print.facet_trelliscope

Print facet trelliscope object
set_labels

Set labels for a data frame
write_config

Write Trelliscope app configuration file
sort_spec

Specify how a display should be sorted
map_cog

Apply a function to each element of a vector and return a vector of cognostics data frames
map2_cog

Map over multiple inputs simultaneously and return a vector of cognostics data frames
map_plot

Apply a function to each element of a vector and return a vector of plots
map2_plot

Map over multiple inputs simultaneously and return a vector of plots
trelliscope

Create a Trelliscope Display
write_display_obj

Write a "display object" file for a Trelliscope app
write_panel

Write a plot object as a panel in a Trelliscope display
write_panels

Write a list of plot objects as panels in a Trelliscope display
trelliscopejs-package

trelliscopejs
auto_cogs

Compute automatic cognostics