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

705

Version

0.1.13

License

BSD_3_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Ryan Hafen

Last Published

February 1st, 2021

Functions in trelliscopejs (0.1.13)

trelliscopejs-package

trelliscopejs
update_display_list

Update Trelliscope app display list file
as_cognostics

Cast a data frame as a cognostics data frame
Trelliscope-shiny

Shiny bindings for Trelliscope
map_plot

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

Labels for ggplot2 "mpg" data
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
img_panel

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

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

Facet Trelliscope
map2_plot

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

Cogs Wrapper Function
cog

Cast Column as a Cognostic
print.facet_trelliscope

Print facet trelliscope object
prepare_display

Set up all auxilliary files needed for a Trelliscope app
map_cog

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

Href Cognostic
set_labels

Set labels for a data frame
write_panels

Write a list of plot objects as panels in a Trelliscope display
+.gg

Add method for gg / facet_trelliscope
panels

Panels Wrapper Function
panel

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

Specify how a display should be sorted
write_cognostics

Write cognostics data for a display in a Trelliscope app
trelliscope

Create a Trelliscope Display
write_config

Write Trelliscope app configuration file
img_panel_local

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