Title: | Create Interactive Multi-Panel Displays |
---|---|
Description: | Trelliscope enables interactive exploration of data frames of visualizations. |
Authors: | Ryan Hafen [aut, cre, cph] |
Maintainer: | Ryan Hafen <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.14 |
Built: | 2024-10-31 16:34:32 UTC |
Source: | https://github.com/trelliscope/trelliscope |
Use fidelius to password protect a trelliscope display
add_charm(trdf, ...)
add_charm(trdf, ...)
trdf |
A trelliscope data frame created with |
... |
Arguments passed to the charm() function in the fidelius package. |
Add inputs to a trelliscope display
add_inputs(trdf, ..., email = NULL, vars = NULL)
add_inputs(trdf, ..., email = NULL, vars = NULL)
trdf |
A trelliscope data frame created with |
... |
Any number of input specifications. These can be specified with
any of |
email |
An email address (optional). |
vars |
A vector of meta variable names found in the display. These will be made available as columns in the csv download of user inputs. |
Add Trelliscope resource path for Shiny app
add_trelliscope_resource_path(prefix, path)
add_trelliscope_resource_path(prefix, path)
prefix , path
|
Add a view specification to a trelliscope display
add_view(trdf, name, ...)
add_view(trdf, name, ...)
trdf |
A trelliscope data frame created with |
name |
The name of the view. |
... |
Any number of state specifications that define the view. These
can be specified with any of |
Convert any trelliscope R6 object to JSON
as_json(trdf, pretty = TRUE)
as_json(trdf, pretty = TRUE)
trdf |
A trelliscope data frame created with |
pretty |
Adds indentation whitespace to JSON output. Can be TRUE/FALSE or a number specifying the number of spaces to indent. |
Render the panels of a trelliscope display
as_panels_df( x, panel_col = "panel", keep_cols = NULL, as_plotly = FALSE, plotly_args = NULL, plotly_cfg = NULL )
as_panels_df( x, panel_col = "panel", keep_cols = NULL, as_plotly = FALSE, plotly_args = NULL, plotly_cfg = NULL )
x |
A ggplot object created with |
panel_col |
The name of the column to store the rendered panels in. |
keep_cols |
An optional vector of extra variable names in |
as_plotly |
Should the panels be written as plotly objects? |
plotly_args |
Optional named list of arguments to send to |
plotly_cfg |
Optional named list of arguments to send to plotly's 'config“ method. |
Instantiate a trelliscope data frame
as_trelliscope_df( df, name = NULL, description = name, key_cols = NULL, tags = NULL, path = NULL, force_plot = FALSE, key_sig = NULL, order = 0, jsonp = TRUE )
as_trelliscope_df( df, name = NULL, description = name, key_cols = NULL, tags = NULL, path = NULL, force_plot = FALSE, key_sig = NULL, order = 0, jsonp = TRUE )
df |
A data frame that contains the metadata of the display as well as a column that indicate the panels to be displayed. |
name |
Name of the trelliscope display. |
description |
Description of the trelliscope display. |
key_cols |
Variable names in |
tags |
Optional vector of tag names to identify the display in the case that there are many to search through. |
path |
Directory in which to place the trelliscope display when
it is written using |
force_plot |
Should the panels be forced to be plotted, even if they have already been plotted and have not changed since the previous plotting? |
key_sig |
A string "signature" that represents the panels for this display. This should not be specified unless you know what you are doing. |
order |
If there will be multiple displays in the same directory, this can be used to specify the order in which they should be listed. The display with the lowest order will be shown on load. |
jsonp |
If true, app data files are written as "jsonp" format, otherwise "json" format. The "jsonp" format makes it possible to browse a trelliscope app without the need for a web server and is set to TRUE by default. Use "json" if you are deploying to a web server that doesn't work well with "jsonp". |
# Use `as_trelliscope_df()` to convert panel metadata to a special # trelliscope data frame library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() meta_dat <- gap |> group_by(country, continent) |> summarise( mean_life_exp = mean(life_exp), min_life_exp = min(life_exp), max_life_exp = max(life_exp), mean_gdp = mean(gdp_percap), .groups = "drop" ) joined_dat <- left_join(panel_dat, meta_dat) |> as_trelliscope_df(name = "life_expectancy", path = tempfile()) ## Not run: view_trelliscope(joined_dat) ## End(Not run) # You can also use `as_trelliscope_df()` on datasets that have links to # images instead of conventional ggplot objects ## Not run:
# Use `as_trelliscope_df()` to convert panel metadata to a special # trelliscope data frame library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() meta_dat <- gap |> group_by(country, continent) |> summarise( mean_life_exp = mean(life_exp), min_life_exp = min(life_exp), max_life_exp = max(life_exp), mean_gdp = mean(gdp_percap), .groups = "drop" ) joined_dat <- left_join(panel_dat, meta_dat) |> as_trelliscope_df(name = "life_expectancy", path = tempfile()) ## Not run: view_trelliscope(joined_dat) ## End(Not run) # You can also use `as_trelliscope_df()` on datasets that have links to # images instead of conventional ggplot objects ## Not run:
Data frame of currencies and their codes
currencies
currencies
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 278 rows and 5 columns.
Create a currency vector
currency(x = double(), code = "USD", digits = 2, locale = TRUE, log = NULL)
currency(x = double(), code = "USD", digits = 2, locale = TRUE, log = NULL)
x |
A numeric vector. |
code |
Currency code. See currencies for a list of possibilities. |
digits |
How many digits to round to when displaying the number.
If |
locale |
Should the variable be displayed using its locale? |
log |
Should the variable's distribution be shown on the log scale? If not specified, an inference will be made based on its values. |
Add a trelliscope facet to a ggplot
facet_panels( facets, scales = "same", add_plot_metrics = FALSE, unfacet = c("none", "line", "point"), unfacet_col = "gray", unfacet_alpha = 0.4, data = ggplot2::waiver() )
facet_panels( facets, scales = "same", add_plot_metrics = FALSE, unfacet = c("none", "line", "point"), unfacet_col = "gray", unfacet_alpha = 0.4, data = ggplot2::waiver() )
facets |
A formula to facet the panels on. Similar to
|
scales |
Should scales be the same ( |
add_plot_metrics |
Should metrics about each panel be automatically calculated? These metrics are based on the context of what is being plotted, e.g. correlation coefficient if plot is a scatterplot. |
unfacet |
Specifies whether to "unfacet" the data such that all of the data appears in the background of the plot. Options are "none" (default), "line" or "point". The latter two options will add either a line or point layer, grouped by the faceting variables, underneath each panel. This is useful for time series plots for viewing each panel in relation to others. |
unfacet_col |
The color to use for the "unfacet" lines or points. |
unfacet_alpha |
The alpha to use for the "unfacet" lines or points. |
data |
data used for faceting. Defaults to the main data argument
to |
# You can run facet_panels() just like how you would run facet_wrap() library(ggplot2) ## Not run: ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ## End(Not run) # facet_panels can also be a jumping off point into setting up a more # developed trelliscope by passing into `as_panels_df()` to create a nested # trelliscope data frame for additional editing. library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell_df <- panel_dat |> as_trelliscope_df(name = "life expectancy", path = "gapminder") |> set_default_layout(ncol = 4) ## Not run: view_trelliscope(trell_df) ## End(Not run)
# You can run facet_panels() just like how you would run facet_wrap() library(ggplot2) ## Not run: ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ## End(Not run) # facet_panels can also be a jumping off point into setting up a more # developed trelliscope by passing into `as_panels_df()` to create a nested # trelliscope data frame for additional editing. library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell_df <- panel_dat |> as_trelliscope_df(name = "life expectancy", path = "gapminder") |> set_default_layout(ncol = 4) ## Not run: view_trelliscope(trell_df) ## End(Not run)
Create a link to another display filtered to categories of a variable
filter_cat_href( display_name, varname, values = NULL, labels = NULL, prefix = NULL )
filter_cat_href( display_name, varname, values = NULL, labels = NULL, prefix = NULL )
display_name |
The name of the display to link to. |
varname |
The name of the variable to filter on. |
values |
The values of the variable to filter on. |
labels |
Labels in the linked display to show. |
prefix |
A prefix to add to the link. Not needed if the display is part of the same app. |
Specify a range "filter" state (applies to numeric, date, and datetime meta variables)
filter_range(varname, min = NULL, max = NULL)
filter_range(varname, min = NULL, max = NULL)
varname |
The name of the variable to filter on. |
min |
Lower bound of the range (if NULL, there is no lower bound). |
max |
Upper bound of the range (if NULL, there is no upper bound). |
Specify a string "filter" state (applies to string and factor meta variables)
filter_string(varname, regexp = NULL, values = NULL)
filter_string(varname, regexp = NULL, values = NULL)
varname |
The name of the variable to filter on. |
regexp |
A search string that can be a regular expression indicating the values of the variable to filter on. |
values |
A vector of specific values of the variable to filter on. If
|
Gapminder data with ISO codes and country centroids
gap
gap
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1704 rows and 9 columns.
https://cran.r-project.org/web/packages/gapminder/index.html
Create a vector of links
href(x = character())
href(x = character())
x |
A character vector. |
Specify a "checkbox" input
input_checkbox(name, label = name, active = TRUE, options)
input_checkbox(name, label = name, active = TRUE, options)
name |
Name of the input. |
label |
Description of the input. |
active |
Should the input be active by default? |
options |
A vector of checkbox options. |
Other inputtypes:
input_multiselect()
,
input_number()
,
input_radio()
,
input_select()
,
input_text()
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_checkbox( name = "Checkbox Input", label = "A space to add custom button inputs", options = c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_checkbox( name = "Checkbox Input", label = "A space to add custom button inputs", options = c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
Specify a "multiselect" input
input_multiselect(name, label = name, active = TRUE, options)
input_multiselect(name, label = name, active = TRUE, options)
name |
Name of the input. |
label |
Description of the input. |
active |
Should the input be active by default? |
options |
A vector of options for the multiselect dropdown. |
Other inputtypes:
input_checkbox()
,
input_number()
,
input_radio()
,
input_select()
,
input_text()
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_multiselect( name = "Multiselect Input", label = "A space to add custom dropdown inputs", options =c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_multiselect( name = "Multiselect Input", label = "A space to add custom dropdown inputs", options =c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
Specify a "numeric" input box
input_number(name, label = name, active = TRUE, min = NULL, max = NULL)
input_number(name, label = name, active = TRUE, min = NULL, max = NULL)
name |
Name of the input. |
label |
Description of the input. |
active |
Should the input be active by default? |
min |
Optional minimum value to allow in the input. |
max |
Optional maximum value to allow in the input. |
Other inputtypes:
input_checkbox()
,
input_multiselect()
,
input_radio()
,
input_select()
,
input_text()
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_number( name = "Numeric Input", label = "A space to add custom ranking for sorting", min = 0, max = 10 ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_number( name = "Numeric Input", label = "A space to add custom ranking for sorting", min = 0, max = 10 ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
Specify a "radio button" input
input_radio(name, label = name, active = TRUE, options)
input_radio(name, label = name, active = TRUE, options)
name |
Name of the input. |
label |
Description of the input. |
active |
Should the input be active by default? |
options |
A vector of radio button options. |
Other inputtypes:
input_checkbox()
,
input_multiselect()
,
input_number()
,
input_select()
,
input_text()
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_radio( name = "Radio Input", label = "A space to add custom ranking for sorting", options = c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_radio( name = "Radio Input", label = "A space to add custom ranking for sorting", options = c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
Specify a "select" input
input_select(name, label = name, active = TRUE, options)
input_select(name, label = name, active = TRUE, options)
name |
Name of the input. |
label |
Description of the input. |
active |
Should the input be active by default? |
options |
A vector of options for the select dropdown. |
Other inputtypes:
input_checkbox()
,
input_multiselect()
,
input_number()
,
input_radio()
,
input_text()
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_select( name = "Select Input", label = "A space to add custom dropdown inputs", options =c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_select( name = "Select Input", label = "A space to add custom dropdown inputs", options =c("yes", "no") ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
Specify a "text box" input
input_text(name, label = name, active = TRUE, height = 3)
input_text(name, label = name, active = TRUE, height = 3)
name |
Name of the input. |
label |
Description of the input. |
active |
Should the input be active by default? |
height |
Height (in lines of text) of the text box input. |
Other inputtypes:
input_checkbox()
,
input_multiselect()
,
input_number()
,
input_radio()
,
input_select()
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_text( name = "Text Input", label = "A space to add custom text input" ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df() |> add_inputs( input_text( name = "Text Input", label = "A space to add custom text input" ) ) ## Not run: view_trelliscope(trell) ## End(Not run)
Mars rover data
mars_rover
mars_rover
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1245 rows and 11 columns.
https://github.com/corincerami/mars-photo-api
Create a number vector
number(x = double(), digits = 2, locale = TRUE, log = NULL)
number(x = double(), digits = 2, locale = TRUE, log = NULL)
x |
A numeric vector. |
digits |
How many digits to round to when displaying the number. If not specified, a value will be inferred. If -1, all digits will be shown. |
locale |
Should the variable be displayed using its locale? For example, 1234.56 in US would be displayed as 1,234.56. |
log |
Should the variable's distribution be shown on the log scale? If not specified, an inference will be made based on its values. |
Add a "calculated panel" column to a dataset
panel_lazy(plot_fn, data = dplyr::pick(dplyr::everything()))
panel_lazy(plot_fn, data = dplyr::pick(dplyr::everything()))
plot_fn |
A function that produces a panel from a given subset of
|
data |
A data frame from which subsets will be extracted and plots will be made. Should be a superset of the summary dataset to which this plot column is being added. |
Add a "panel_local" column to a dataset
panel_local(x = character(), type = NULL)
panel_local(x = character(), type = NULL)
x |
A character vector of paths to local files to be used as panels. |
type |
The "type" of panel ("img" or "iframe"). If NULL, will be inferred from the file extension. |
Specify options for lazily-rendered panels in a Trelliscope display
panel_options( width = NULL, height = NULL, format = NULL, force = FALSE, prerender = TRUE )
panel_options( width = NULL, height = NULL, format = NULL, force = FALSE, prerender = TRUE )
width |
Width in pixels of each panel. |
height |
Height in pixels of each panel. |
format |
The format of the panels the server will provide. Can be one of "png" , "svg", or "html". Ignored if panel is not lazy. |
force |
Should server force panels to be written? If |
prerender |
If "TRUE", lazy panels will be rendered prior to viewing the display. If "FALSE", a local R websockets server will be created and plots will be rendered on the fly when requested by the app. The latter is only available when using Trelliscope locally. Ignored if panel is not lazy. |
mars_rover |> as_trelliscope_df(name = "mars rover") |> set_panel_options(img_src = panel_options(width = 2, height = 1)) # TODO
mars_rover |> as_trelliscope_df(name = "mars rover") |> set_panel_options(img_src = panel_options(width = 2, height = 1)) # TODO
Add a "panel_url" column to a dataset
panel_url(urls, type = NULL)
panel_url(urls, type = NULL)
urls |
A character vector of URLs to be used as panels. |
type |
The "type" of panel ("img" or "iframe"). If NULL, will be inferred from the file extension. |
Base-64 encoded icon of a rover for use in the Mars rover example
rover_icon_b64
rover_icon_b64
An object of class character
of length 1.
Add a filter state specifications to a trelliscope display
set_default_filters(trdf, ..., add = TRUE)
set_default_filters(trdf, ..., add = TRUE)
trdf |
A trelliscope data frame created with |
... |
Filter state specifications (e.g. |
add |
Should existing filter state specifications be added to? Default is TRUE. If FALSE, the entire sort specification will be overridden. |
Add a labels state specification to a trelliscope display
set_default_labels(trdf, varnames)
set_default_labels(trdf, varnames)
trdf |
A trelliscope data frame created with |
varnames |
A vector of variable names whose values should appear as labels. If NULL, no labels will be displayed. when viewing the display. |
Add a layout state specification to a trelliscope display
set_default_layout( trdf, ncol = 1, page = 1, sidebar = FALSE, visible_filters = NULL )
set_default_layout( trdf, ncol = 1, page = 1, sidebar = FALSE, visible_filters = NULL )
trdf |
A trelliscope data frame created with |
ncol |
Number of columns of panels to show. |
page |
The page number to show. |
sidebar |
Should the sidebar be shown? |
visible_filters |
A vector of variable names to add as visible filters in the sidebar. |
Add a labels state specification to a trelliscope display
set_default_sort(trdf, varnames, dirs = "asc", add = FALSE)
set_default_sort(trdf, varnames, dirs = "asc", add = FALSE)
trdf |
A trelliscope data frame created with |
varnames |
A vector of variable names to sort on. |
dirs |
A vector of directions to sort on ("asc" or "desc"). |
add |
Should an existing sort specification be added to? If FALSE (default), the entire sort specification will be overridden. |
Specify custom "display info" html
set_info_html(trdf, file)
set_info_html(trdf, file)
trdf |
A trelliscope data frame created with |
file |
Path to an existing html file to use. |
Set panel options for a Trelliscope display
set_panel_options(trdf, ...)
set_panel_options(trdf, ...)
trdf |
A trelliscope data frame created with |
... |
A named set panel options to set. The names should
correspond to the names of the variables in the data frame. The values
should come from |
mars_rover |> as_trelliscope_df(name = "mars rover") |> set_panel_options(img_src = panel_options(width = 2, height = 1))
mars_rover |> as_trelliscope_df(name = "mars rover") |> set_panel_options(img_src = panel_options(width = 2, height = 1))
Set the primary panel of a trelliscope display
set_primary_panel(trdf, name)
set_primary_panel(trdf, name)
trdf |
A trelliscope data frame created with |
name |
The name of the panel to set as the primary panel that will be viewed when launching the app. |
Show "display info" when display first loads
set_show_info_on_load(trdf, show = TRUE)
set_show_info_on_load(trdf, show = TRUE)
trdf |
A trelliscope data frame created with |
show |
Should display info be shown on load? |
Set tags for variables in a data frame
set_tags(d, ...)
set_tags(d, ...)
d |
A data frame. |
... |
A named set of vectors of variable names, where each name is a tag and each value in each vector corresponds to one of the variables in the dataset. |
set_tags(iris, info = "Species", metrics = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"), width = c("Sepal.Width", "Petal.Width"))
set_tags(iris, info = "Species", metrics = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"), width = c("Sepal.Width", "Petal.Width"))
Set a color theme for a Trelliscope display
set_theme( trdf, primary = "#448aff", primary2 = "#4dabf5", primary3 = "#2e60b1", background = "#FEFEFE", background2 = "#EBEBEB", background3 = "#E0E0E0", bars = "#FFAE25", text = "#000", text2 = "#FFF", button_text = "#757575", text_disabled = "#BCBCBC", error = "#ff5252", font_family = "\"Poppins\", sans-serif", logo = NULL )
set_theme( trdf, primary = "#448aff", primary2 = "#4dabf5", primary3 = "#2e60b1", background = "#FEFEFE", background2 = "#EBEBEB", background3 = "#E0E0E0", bars = "#FFAE25", text = "#000", text2 = "#FFF", button_text = "#757575", text_disabled = "#BCBCBC", error = "#ff5252", font_family = "\"Poppins\", sans-serif", logo = NULL )
trdf |
A trelliscope data frame created with |
primary |
The primary color which applies to the main controls in the app (buttons, navigation icons, checkboxes, etc.). |
primary2 |
The second-level primary color which applies to hover states, etc. Typically a slightly lighter shade of the primary color. |
primary3 |
The third-level primary color, mainly used for the fullscreen button. Typically a slightly darker shade of the primary color. |
background |
The background color of the app. |
background2 |
The second-level background color used in various components and headers. Typically a slightly lighter or darker shade of the background color. |
background3 |
The third-level background color used for inactive filter bars, sub-header background, component outlines, etc. Typically a slightly lighter or darker shade of the background color. |
bars |
Color used for highlighted bars in the filter graphs (histogram and bar chart). |
text |
The general text color used in the app. |
text2 |
The secondary text color used in the header, etc. Should be a contrasting color to the primary color. |
button_text |
The text color used for buttons. Should be a contrasting color to the primary color. |
text_disabled |
The text color used for disabled buttons, etc. |
error |
The color used for error messages. |
font_family |
The font family to use in the app. Default is "Poppins". Note that many aspects of the app are styled with this font, so changing it may result in less-attractive styling. |
logo |
URL (relative or absolute) to a logo image to include in the header. |
x <- mars_rover |> as_trelliscope_df(name = "mars rover") |> set_theme( primary = "#c80000", primary2 = "#f00000", primary3 = "#960000", background = "#222222", background2 = "#444444", background3 = "#333333", bars = "#c80000", text = "#ffffff", text2 = "#ffffff", text_disabled = "#bcbcbc", logo = rover_icon_b64 )
x <- mars_rover |> as_trelliscope_df(name = "mars rover") |> set_theme( primary = "#c80000", primary2 = "#f00000", primary3 = "#960000", background = "#222222", background2 = "#444444", background3 = "#333333", bars = "#c80000", text = "#ffffff", text2 = "#ffffff", text_disabled = "#bcbcbc", logo = rover_icon_b64 )
Set labels for variables in a data frame
set_var_labels(d, ...)
set_var_labels(d, ...)
d |
A data frame. |
... |
A named set of labels, where each name must correspond to one of the variables in the dataset. |
set_var_labels(mtcars, mpg = "Miles per gallon", cyl = "Number of cylinders")
set_var_labels(mtcars, mpg = "Miles per gallon", cyl = "Number of cylinders")
View trelliscope info of a trelliscope data frame
show_info(trdf)
show_info(trdf)
trdf |
A trelliscope data frame created with |
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(~country + continent) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df(name = "life expectancy", path = "gapminder") |> set_default_layout(ncol = 4) show_info(trell)
library(ggplot2) library(dplyr) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(~country + continent) ) |> as_panels_df() trell <- panel_dat |> as_trelliscope_df(name = "life expectancy", path = "gapminder") |> set_default_layout(ncol = 4) show_info(trell)
Specify a "labels" state
state_labels(varnames = NULL)
state_labels(varnames = NULL)
varnames |
A vector of variable names whose values should appear as labels. If NULL, no labels will be displayed. when viewing the display. |
Specify a "layout" state
state_layout( ncol = 1, page = 1, sidebar = FALSE, viewtype = c("grid", "table"), visible_filters = NULL )
state_layout( ncol = 1, page = 1, sidebar = FALSE, viewtype = c("grid", "table"), visible_filters = NULL )
ncol |
Number of columns of panels to show. |
page |
The page number to show. |
sidebar |
Should the sidebar be shown? |
viewtype |
The type of view to show ("grid" or "table"). |
visible_filters |
A vector of variable names to add as visible filters in the sidebar. |
Specify a "sort" state
state_sort(varname, dir = "asc")
state_sort(varname, dir = "asc")
varname |
The name of the variable to sort on. |
dir |
One of "asc" or "desc", describing the direction of the sort. |
Output and render functions for using trelliscope within Shiny applications and interactive Rmd documents.
trelliscopeOutput(outputId, ...) renderTrelliscope(expr, env = parent.frame(), quoted = FALSE)
trelliscopeOutput(outputId, ...) renderTrelliscope(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
... |
Argumentsed passed on to |
expr |
An expression that generates a trelliscope |
env |
The environment in which to evaluate |
quoted |
Is |
Update the list of all displays in an app directory
update_display_list(app_path, jsonp = TRUE, id)
update_display_list(app_path, jsonp = TRUE, id)
app_path |
The path where all of the displays are stored |
jsonp |
If true, files are read and written as "jsonp" format, otherwise "json" format. The "jsonp" format makes it possible to browse a trelliscope app without the need for a web server. |
id |
The id of the display. Can be found in |
View a trelliscope display
view_trelliscope(trdf = NULL)
view_trelliscope(trdf = NULL)
trdf |
A trelliscope data frame created with |
library(ggplot2) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() disp <- panel_dat |> as_trelliscope_df(name = "life_expectancy") ## Not run: view_trelliscope(disp) ## End(Not run)
library(ggplot2) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() disp <- panel_dat |> as_trelliscope_df(name = "life_expectancy") ## Not run: view_trelliscope(disp) ## End(Not run)
Write the contents of a display
write_trelliscope(trdf, force_write = NULL, jsonp = NULL)
write_trelliscope(trdf, force_write = NULL, jsonp = NULL)
trdf |
A trelliscope data frame created with |
force_write |
Should the panels be forced to be written even if they have already been written? |
jsonp |
If true, app files are written as "jsonp" format, otherwise "json" format. The "jsonp" format makes it possible to browse a trelliscope app without the need for a web server. |
library(ggplot2) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() disp <- panel_dat |> as_trelliscope_df(name = "life_expectancy") ## Not run: disp <- write_trelliscope(disp) view_trelliscope(disp) ## End(Not run)
library(ggplot2) panel_dat <- ( ggplot(gap, aes(year, life_exp)) + geom_point() + facet_panels(vars(country, continent)) ) |> as_panels_df() disp <- panel_dat |> as_trelliscope_df(name = "life_expectancy") ## Not run: disp <- write_trelliscope(disp) view_trelliscope(disp) ## End(Not run)