Package 'd3plus'

Title: Seamless 'D3Plus' Integration
Description: Provides functions that offer seamless 'D3Plus' integration. The examples provided here are taken from the official 'D3Plus' website <http://d3plus.org>.
Authors: Mauricio Vargas [aut,cre], Joshua Kunst [aut], Dave Landry [ctb], Datawheel [cph]
Maintainer: Mauricio Vargas <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-10 06:37:45 UTC
Source: CRAN

Help Index


Pass a tibble or data frame to 'D3Plus' objects

Description

This function provides a 1:1 translation between tibble-like objects in R and JSON structured data needed by 'D3Plus' to display a treemap, barchart or any other 'D3Plus' method. This function is useless if d3plus() is not called first.


Defines the ids (such as axis) that 'D3Plus' objects require

Description

This function provides a 1:1 translation between column names i an R tibble-like object and ids that 'D3Plus' needs to draw axis, bars, areas, etc. This function is useless if d3plus() is not called first.


Defines 'D3Plus' axis for network method

Description

'D3Plus' networks requiere to specify nodes and links in order to work. This function is useless if d3plus() is not called first.


Defines the 'D3Plus' method to use

Description

This function defines if the program will display a treemap, a barchart, an horizontal barchart or other 'D3Plus' method. This function is useless if d3plus() is not called first.


Defines 'D3Plus' axis for some methods

Description

Some 'D3Plus' methods such as barchart requiere to display which variable to display on the x and y axis, and this function specifies that. This function is useless if d3plus() is not called first.


Defines 'D3Plus' axis for some methods

Description

Some 'D3Plus' methods such as barchart requiere to display which variable to display on the x and y axis, and this function specifies that. This function is useless if d3plus() is not called first.


An 'htmlwidget' interface to the d3plus javascript chart library

Description

An 'htmlwidget' interface to the d3plus javascript chart library

This function provides 'D3Plus' methods from R console

Usage

d3plus(data, width = NULL, height = NULL, elementId = NULL)

Arguments

data

D3Plus need explicit specified data objects formatted as JSON, and this parameter passed it from R.

width

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

height

Same as width parameter.

elementId

Dummy string parameter. Useful when you have two or more charts on the same page.

Author(s)

Mauricio Vargas

Examples

dta <- data.frame(
         id = c("alpha", "alpha", "alpha", "beta", "beta", "beta"),
         x = c(4,5,6,4,5,6),
         y = c(7,25,13,7,8,13)
       )

d3plus() %>% d3p_data(dta) %>% d3p_type("bar")
d3plus() %>% d3p_data(dta) %>% d3p_type("hbar")
d3plus() %>% d3p_data(dta) %>% d3p_type("area")

d3plus exported operators and S3 methods

Description

The following functions are imported and then re-exported from the d3plus package to avoid listing the magrittr as Depends of d3plus.


Shiny bindings for 'D3Plus'

Description

Output and render functions for using D3Plus within Shiny applications and interactive Rmd documents.

Usage

d3plusOutput(outputId, width = "100%", height = "400px")

renderD3plus(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

expr

An expression that generates a D3Plus object

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.