Package 'rD3plot'

Title: Interactive Networks, Timelines, Barplots, Galleries with 'D3.js'
Description: Creates interactive analytic graphs with 'R'. It joins the data analysis power of R and the visualization libraries of JavaScript in one package. The package provides interactive networks, timelines, barplots, image galleries and evolving networks. Graphs are represented as 'D3.js' graphs embedded in a web page ready for its interactive analysis and exploration.
Authors: Modesto Escobar [aut, cph, cre] , Carlos Prieto [aut] , David Barrios [aut]
Maintainer: Modesto Escobar <[email protected]>
License: GPL-2 | GPL-3
Version: 1.1.21
Built: 2024-10-19 03:30:38 UTC
Source: CRAN

Help Index


The rD3plot package.

Description

Creates interactive analytic graphs with 'R'. It joins the data analysis power of R and the visualization libraries of JavaScript in one package. The package provides interactive networks, timelines, barplots, image galleries and evolving networks. Graphs are represented as D3 graphs embedded in a web page ready for its interactive analysis and exploration


Adds a tutorial for the gallery.

Description

add_tutorial_rd3 adds a tutorial for a gallery.

Usage

add_tutorial_rd3(x, image = NULL, description = NULL)

Arguments

x

object of class gallery_rd3.

image

character vector indicating the image path, header for the tutorial.

description

a character string indicating a desription text to insert in the tutorial.

Value

Object of class gallery_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data("finches")
finches$species <- system.file("extdata", finches$species,
        package="rD3plot") # copy path to the species field
gallery <- gallery_rd3(finches, image="species", main="Species in Galapagos Islands",
        note="Data source: Sanderson (2000)")

gallery <- add_tutorial_rd3(gallery, 
  description="Here you can see different finches species in Galapagos islands.")

## Not run: 
plot(gallery)

## End(Not run)

Networked barplot.

Description

barplot_rd3 produces an interactive barplot of coincidences between events.

Usage

barplot_rd3(events, links, name = NULL, select = NULL,
        source = NULL, target = NULL,
        label = NULL, text = NULL, color = NULL,
        incidences = NULL, coincidences = NULL,
        expected = NULL, confidence = NULL, level = .95, significance = NULL,
        sort = NULL, decreasing = FALSE,
        scalebar = FALSE, defaultColor = "#1f77b4", note = NULL, cex = 1,
        language = c("en","es","ca"), dir = NULL)

Arguments

events

a data frame with at least two columns of event names (by default 1st column) and incidences (2nd column). Columns for each variable can be specified at name and incidences parameters.

links

a data frame with at least three columns indicating source event, target event and number of coincidences (in that order). Columns assigned to each variable can be specified at source, target and concidences parameters.

name

column name with event names in the events data frame.

source

column name with source names in the links data frame.

target

column name with target names in the links data frame.

select

event name to start the visualization.

label

column name with labels in the events data frame.

text

column name with html text in the events data frame.

color

column name with color variable in the events data frame.

coincidences

column nane with coincidences in the links data frame.

incidences

column name with incidences in the events data frame.

expected

column name with expected coincidences in the links data frame.

confidence

column name with confidence interval in the links data frame.

level

confidence level

significance

column name with significance in the links data frame.

sort

column name in the events data frame to order the bars in the graph.

decreasing

order the events in a decreasing order.

scalebar

bars are represented filling all the screen height.

defaultColor

a string giving a valid html color.

note

the lower title of the graph.

cex

a number giving the amount by which plotting text should be scaled relative to the default.

language

a character string indicating the language of the graph (en=english (default); es=spanish; ca=catalan).

dir

a character string representing the directory where the web files will be saved.

Value

Object of class barplot_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data(finches)
data(galapagos)
barplot <- barplot_rd3(finches, galapagos, select="Certhidea olivacea",
            note="Data source: Sanderson (2000)")
## Not run: 
plot(barplot)

## End(Not run)

Create evolving networks.

Description

evolNetwork_rd3 produce an evolving network.

Usage

evolNetwork_rd3(..., frame = 0, speed = 50, loop = FALSE, lineplots = NULL,
  dir = NULL)

Arguments

...

network_rd3 objects that will be integrated as temporal frames in the evolving network.

frame

a frame ordinal position where the playback will start.

speed

a percentage value for the playback speed of network frames.

loop

allowing continuous repetition.

lineplots

a character vector giving the node attributes to show as lineplots.

dir

a "character" string representing the directory where the graph will be saved.

Value

This function returns a network_rd3 object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

nets <- list()
N <- data.frame(name=paste0("node",1:2))
E <- data.frame(Source="node1",Target="node2")
nets[["net1"]] <- network_rd3(N, E, repulsion=98, label=FALSE)

for(i in 3:100){
  N <- rbind(N,data.frame(name=paste0("node",i)))
  E <- rbind(E,data.frame(Source=paste0("node",i-1),Target=paste0("node",i)))
  nets[[paste0("net",i-1)]] <- network_rd3(N, E, repulsion=100-i, label=FALSE)
}

nets$speed=100

net <- do.call(evolNetwork_rd3,nets)

## Not run: 
plot(net)

## End(Not run)

Data: Finches' attributes in Galapagos islands.

Description

Data frame with events as result.

Usage

data("finches")

Format

A data frame with 13 observations (pinches) and 4 variables (name and characteristics):

name

: Genus and species of the finche

frequency

: number of islands where the finche can be found

type

: Genus of the finche

species

: name of the file containing the picture of the finche

References

Sanderson, James (2000). Testing Ecological Patterns: A Well-known Algorithm from Computer Science Aids the Evaluation of Species Distributions. American Scientist, 88, pp. 332-339.

Examples

data(finches)
head(finches,10)

Data: Finches' presence in Galapagos Islands.

Description

Data frame containing data of finches coapperance in the Galagos Islands.

Usage

data("galapagos")

Format

This links data set consists of three variables of length 60:

Source

: Finche 1

Target

: Finche 2

coincidences

: number of islands they share

References

Sanderson, James (2000). Testing Ecological Patterns: A Well-known Algorithm from Computer Science Aids the Evaluation of Species Distributions. American Scientist, 88, pp. 332-339.

Examples

data(galapagos)
head(galapagos,10)

Images in a grid gallery.

Description

gallery2_rd3 produces an interactive image gallery (alternative display).

Usage

gallery2_rd3(nodes, name = NULL, label = NULL, subtitle = NULL, order = NULL,
  decreasing = FALSE, ntext = NULL, mainframeHeight = NULL, image = NULL,
  zoom = NULL, main = NULL, note = NULL, export = FALSE, colorScheme = 0,
  language = c("en", "es", "ca"), dir = NULL)

Arguments

nodes

a data frame with at least one column with the names of the gallery's elements.

name

name of the vector with names in the nodes data frame.

label

column name with image labels in the nodes data frame.

subtitle

column name with image subtitles in the nodes data frame.

order

name of the column with node order in the nodes data frame.

decreasing

decreasing or increasing sort of the nodes.

ntext

column name with html text in the nodes data frame.

mainframeHeight

a number between 0.1 and 1 to reduce mainframe height.

image

column name which indicates the image paths in the nodes data frame.

zoom

a number between 0.1 and 1 to reduce item sizes.

main

upper title of the graph.

note

lower title of the graph.

export

A button will appear to export gallery as excel.

colorScheme

Select a color theme for display (0-11).

language

a character string indicating the language of the graph (en=english (default); es=spanish; ca=catalan).

dir

a character string representing the directory where the web files will be saved.

Value

Object of class gallery_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data("finches")
finches$species <- system.file("extdata", finches$species,
        package="rD3plot") # copy path to the species field
gallery <- gallery2_rd3(finches, image="species")
## Not run: 
plot(gallery)

## End(Not run)

Coappearance network of characters in Les Miserables (undirected)

Description

A list of two datasets, vertices and edges, containing data on characters and their coapperance in chapters in Victor Hugo's Les Miserables.

Usage

data("miserables")

Format

A list of two data frames:

  • the links data set consists of three variables of length 254:

    • Source: Character 1

    • Target: Character 2

    • value: number of times they appear together in a chapter of Les Miserables

  • the nodes data set consists of two variables with information on 77 characters:

    • name: Character name

    • group: Character group

References

D. E. Knuth, The Stanford GraphBase: A Platform for Combinatorial Computing, Addison-Wesley, Reading, MA (1993).

Examples

data(miserables)
head(miserables,10)

Interactive network.

Description

network_rd3 produces a network_rd3 object ready for its representation as an interactive network in a web browser. Its input has to be two data.frames: one of attributes of events or nodes, and the other of attributes of the edges or links.

Usage

network_rd3(nodes = NULL, links = NULL, tree = NULL,
        community = NULL, layout = NULL,
        name = NULL, label = NULL, group = NULL, groupText = FALSE,
        labelSize = NULL, size = NULL, color = NULL, shape = NULL,
        border = NULL, legend = NULL, sort = NULL, decreasing = FALSE,
        ntext = NULL, info = NULL, image = NULL, imageNames = NULL,
        nodeBipolar = FALSE, nodeFilter = NULL, degreeFilter = NULL,
        source = NULL, target = NULL,
        lwidth = NULL, lweight = NULL, lcolor = NULL, ltext = NULL,
        intensity = NULL, linkBipolar = FALSE, linkFilter = NULL,
        repulsion = 25, distance = 10, zoom = 1,
        fixed = showCoordinates, limits = NULL,
        main = NULL, note = NULL, showCoordinates = FALSE, showArrows = FALSE,
        showLegend = TRUE, frequencies = FALSE, showAxes = FALSE,
        axesLabels = NULL, scenarios = NULL, help = NULL, helpOn = FALSE,
        mode = c("network","heatmap"), roundedItems = FALSE, controls = 1:8,
        cex = 1, background = NULL, defaultColor = "#1f77b4",
        language = c("en","es","ca"), dir = NULL)

Arguments

nodes

a data frame with at least one column of node names.

links

a data frame with at least two columns with source and target node names.

tree

a data frame with two columns: source and target, describing relationships between nodes. It indicates a hierarchy between nodes which can be dynamically explored.

name

name of the column with names in the nodes data frame.

source

name of the column with source names in the links data frame.

target

name of the column with target names in the links data frame.

label

name of the column with labels in the nodes data frame.

group

name of the column with groups in the nodes data frame.

groupText

show names of the groups.

community

algorithm to make communities: edge_betweenness("ed"), fast_greedy("fa"), label_prop("la"), leiden_eigen("le"), louvain("lo"), optimal("op"), spinglass("sp"), walktrap("wa")

labelSize

name of the column with label size in the nodes data frame.

size

name of the column with size in the nodes data frame.

color

name of the column with color variable in the nodes data frame.

shape

name of the column with shape variable in the nodes data frame.

legend

name of the column with the variable to represent as a legend in the nodes data frame.

ntext

name of the column with html text in the nodes data frame.

info

name of the column with information to display in a panel in the nodes data frame.

border

name of the column with border width in the nodes data frame.

sort

name of the column with node order in the nodes data frame (only for heatmap).

decreasing

decreasing or increasing sort of the nodes (only for heatmap).

intensity

name of the column with intensity variable in the links data frame (only for heatmap).

lwidth

name of the column with width variable in the links data frame.

lweight

name of the column with weight variable in the links data frame.

lcolor

name of the column with color variable in the links data frame.

ltext

name of the column with labels in the links data frame.

nodeFilter

a character string with a condition for filtering nodes.

linkFilter

a character string with a condition for filtering links.

degreeFilter

numeric vector to filter the resulting network by degree. Input can be a number which specifies the minimum degree or two numbers which specify the lower and upper limits of the filter.

nodeBipolar

a logical value that polarizes negative and positive node values in the graphical representation. Indicates whether the color key should be made symmetric about 0.

linkBipolar

a logical value that polarizes negative and positive link values in the graphical representation. Indicates whether the color key should be made symmetric about 0.

defaultColor

a character vector giving a valid html color for node representation.

repulsion

a percentage for repulsion between nodes.

distance

a percentage for distance of links.

zoom

a number between 0.1 and 10 to start displaying zoom.

fixed

prevent nodes from being dragged.

scenarios

a note showing number of scenarios.

main

upper title of the graph.

note

lower title of the graph.

frequencies

a logical value true if barplots representing node attributes frequencies will be added to the final graph.

help

help text of the graph.

helpOn

Should the help be shown at the beginning?

background

background color or image path of the graph.

layout

a matrix with two columns with x/y coordinates or an algorithm to calculate the static layout of the network: davidson.harel drl("da"), circle("ci"), Force-Atlas-2("fo"), fruchterman.reingold("fr"), gem("ge"), grid("gr"), kamada.kawai("ka"), lgl("lg"), mds("md"), random("ra"), reingold.tilford("re"), star("sta"), sugiyama("sug")

limits

vector indicating the layout limits, must be a numeric vector of length 4 on this order: x_min, y_min, x_max, y_max.

cex

number indicating the amount by which plotting text should be scaled relative to the default.

roundedItems

Display images with rounded borders.

controls

a numeric vector indicating which controls will be shown. 1 = sidebar, 2 = selection buttons, 3 = export buttons, 4 = nodes table, 5 = links table, 6 = search, 7 = zoom, 8 = legend. NULL hide all controls, negative values deny each control and 0 deny all.

mode

a character vector indicating the graph mode allowed: network, heatmap or both (both by default).

showCoordinates

a logical value true if the coordinates are to be shown in tables and axes. Default = FALSE.

showArrows

a logical value true if the directional arrows are to be shown. Default = FALSE.

showLegend

a logical value true if the legend is to be shown.

showAxes

a logical value true if the axes are to be shown.

axesLabels

a character vector giving the axes names.

language

a character string indicating the language of the graph (en=english (default); es=spanish; ca=catalan).

image

name of the column with the path to node image files in the nodes data frame.

imageNames

name of the column with names for image files in the nodes data frame which will be shown in the legend.

dir

a "character" string representing the directory where the resulting web files will be saved.

Value

This function returns a network_rd3 object. If the 'dir' attribute is specified, the function creates a folder in the computer with an HTML document named index.html which contains the produced graph. This file can be directly opened with your browser and sent to a web server to work properly.

Note

nodes and links arguments can be substituted by a network_rd3 object to add or change options to it.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data(miserables)
net <- network_rd3(miserables$nodes, miserables$links,
         size="degree", color="group", lwidth="value")
## Not run: 
plot(net)

## End(Not run)

Networked barplot.

Description

pie_rd3 produces an interactive barplot of coincidences between events.

Usage

pie_rd3(v, w = NULL, labels = NULL, colors = NULL, nodes = NULL, links = NULL,
  name = NULL, source = NULL, target = NULL, lcolor = NULL,
  ablineX = NULL, ablineY = NULL, hideUpper = FALSE, main = NULL, note = NULL,
  showLegend = TRUE, help = NULL, helpOn = FALSE,
  cex = 1, language = c("en", "es", "ca"), dir = NULL)

Arguments

v

a vector or array of non-negative numerical quantities. The values are displayed as the areas of pie slices.

w

an array of non-negative numerical quantities. The first value is displayed as a pie slice bordered red.

labels

character strings giving names for the slices.

colors

a vector of colors to be used in filling the slices.

nodes

a data frame with information for rows and columns.

links

a data frame with information for each pie.

name

name of the column with rownames and colnames in the nodes data frame.

source

name of the column with rownames in the links data frame.

target

name of the column with colnames in the links data frame.

lcolor

name of the column with color variable in the links data frame.

ablineX

adds one or more straight vertical lines between pies.

ablineY

adds one or more straight horizontal lines between pies.

hideUpper

should hide the upper triangle?

main

upper title of the graph.

note

lower title of the graph.

showLegend

a logical value true if the legend is to be shown.

help

a character string indicating a help text of the graph.

helpOn

Should the help be shown at the beginning?

cex

number indicating the amount by which plotting text should be scaled relative to the default.

language

a character vector (es=spanish; en=english; ca=catalan).

dir

a character string representing the directory where the web files will be saved.

Value

Object of class pie_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

pie <- pie_rd3(1:4, labels = c("XY","X","","Y"),
  colors = c("black","cadetblue2", "white","cadetblue3"))
## Not run: 
plot(pie)

## End(Not run)

Adds a description to a 'rD3plot' object.

Description

rd3_addDescription adds a description to a 'rD3plot' object.

Usage

rd3_addDescription(x, description)

Arguments

x

A 'rD3plot' object.

description

the description text.

Value

A 'rD3plot' object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data(finches)
data(galapagos)
bar <- barplot_rd3(finches, galapagos, select="Certhidea olivacea")
img <- system.file("extdata", "p.Crassirostris.png",
        package="rD3plot")
bar <- rd3_addDescription(bar,"Species coincidences in Galapagos Islands")
multi <- rd3_multigraph(barplot=bar)
## Not run: 
rd3_multiPages(multi,"Graph image example",show=TRUE)

## End(Not run)

Adds an image to a 'rD3plot' object.

Description

rd3_addImage adds an image to a 'rD3plot' object.

Usage

rd3_addImage(x, img)

Arguments

x

A 'rD3plot' object.

img

character vector indicating the image path.

Value

A 'rD3plot' object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data(finches)
data(galapagos)
bar <- barplot_rd3(finches, galapagos, select="Certhidea olivacea")
img <- system.file("extdata", "p.Crassirostris.png",
        package="rD3plot")
bar <- rd3_addImage(bar,img)
multi <- rd3_multigraph(barplot=bar)
## Not run: 
rd3_multiPages(multi,"Graph image example",show=TRUE)

## End(Not run)

Produce interactive networks from 'igraph' objects.

Description

rd3_fromIgraph produce an interactive network from an 'igraph' object.

Usage

rd3_fromIgraph(G, ...)

Arguments

G

an igraph object.

...

Any network_rd3 argument.

Value

This function returns a network_rd3 object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

g <- igraph::make_ring(10)
rd3_fromIgraph(g)

Produce a circle layout of any number of nodes.

Description

rd3_layoutCircle produces a circle layout of any number of nodes.

Usage

rd3_layoutCircle(N,nodes=seq_len(nrow(N)),deg=0,name=NULL)

Arguments

N

a data frame of nodes.

nodes

a vector specifing the node names inclued in the layout calculation.

deg

rotation degrees.

name

column name with node names in the N data frame.

Value

‘rd3_layoutCircle’ produces a circle layout of any number of nodes.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

A <- data.frame(name=letters)
L <- rd3_layoutCircle(A,name="name")
net <- network_rd3(A,layout=L)
## Not run: 
plot(net)

## End(Not run)

Produce a grid layout of any number of nodes.

Description

rd3_layoutGrid produces a grid layout of any number of nodes.

Usage

rd3_layoutGrid(N,string,name=NULL,byrow=FALSE)

Arguments

N

a data frame of nodes.

string

a character vector specifing grouped nodes.

name

column name with node names in the N data frame.

byrow

order nodes by row (default) or by columns (FALSE)

Value

‘rd3_layoutGrid’ produces a grid layout of any number of nodes.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

A <- data.frame(name=letters)
L <- rd3_layoutGrid(A,"a,b,c,d,e.f,g,h,i,j.k,l,m,n,o,p.q,r,s,t,u.v,w,x,y,z","name")
net <- network_rd3(A,layout=L)
## Not run: 
plot(net)

## End(Not run)

Integrates interactive 'rD3plot' graphs.

Description

rd3_multigraph produce an interactive multi graph with the integration of 'rD3plot' graphs in the final result.

Usage

rd3_multigraph(..., mfrow = NULL, dir = NULL)

Arguments

...

rD3plot graphs (network_rd3, barplot_rd3, timeplot_rd3) objects or string paths to html "directories".

mfrow

a vector of the form 'c(nr, nc)'. Subsequent graphs will be drawn in an 'nr'-by-'nc' array on the device by rows.

dir

a "character" string representing the directory where the graph will be saved.

Value

This function returns a multi_rd3 object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data(miserables)
net <- network_rd3(miserables$nodes, miserables$links,
         size="degree", color="group", lwidth="value")

data(finches)
data(galapagos)
bar <- barplot_rd3(finches, galapagos, select="Certhidea olivacea")

data(sociologists)
time <- timeline_rd3(sociologists,"name","birth","death","birthcountry")

multi <- rd3_multigraph(network=net, barplot=bar, timeline=time)
## Not run: 
plot(multi)

## End(Not run)

Produces a gallery of 'rD3plot' graphs.

Description

rd3_multiPages produces a gallery page to explore multiple 'rD3plot' graphs.

Usage

rd3_multiPages(x, title = NULL, columns = NULL, imageSize = NULL,
  description = NULL, note = NULL,
  cex = 1, dir = tempDir(), show = FALSE)

Arguments

x

is a multi_rd3 object. See rd3_multigraph

title

the text for a main title.

columns

a numeric vector giving the number of columns to display items in gallery. Default = 3.

imageSize

a numeric vector giving the size of images in gallery. Default = 75.

description

a description text for the gallery.

note

a footer text for the gallery.

cex

number indicating the amount by which plotting text should be scaled relative to the default. Default = 1.

dir

a "character" string representing the directory where the graph will be saved.

show

a logical value true if the graph is to be shown. Default = FALSE.

Value

The function creates a folder in your computer with an HTML document named index.html which contains the graph. This file can be directly opened with your browser.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

data(miserables)
net <- network_rd3(miserables$nodes, miserables$links,
         size="degree", color="group", lwidth="value")

data(finches)
data(galapagos)
bar <- barplot_rd3(finches, galapagos, select="Certhidea olivacea")

data(sociologists)
time <- timeline_rd3(sociologists,"name","birth","death","birthcountry")

multi <- rd3_multigraph(network=net, barplot=bar, timeline=time)
## Not run: 
rd3_multiPages(multi,"Some graphs",show=TRUE)

## End(Not run)

'igraph' object.

Description

creates an igraph object from a network_rd3 object.

Usage

rd3_toIgraph(net)

Arguments

net

is a network_rd3 object. See network_rd3

Value

An igraph object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

# A character column (with separator)
data(miserables)
net <- network_rd3(miserables$nodes, miserables$links,
  size="degree", color="group", lwidth="value")
rd3_toIgraph(net) # conversion into a igraph object

Include rD3plot graphs in 'Shiny'.

Description

Load a rD3plot graph to display in 'Shiny'.

Usage

shiny_rd3(x)

Arguments

x

is a network_rd3, barplot_rd3 or timeplot_rd3 object.

Value

This function returns a shiny.tag object.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.


Data: Sociologists born in the 19th century.

Description

Data frame with names, birth and death year data, birth country and movement.

Usage

data("sociologists")

Format

A data frame with 33 observations and the following 4 variables (events) to study coincidences in time:

name

: name and last name of the sociologist

birth

: birth year

death

: death year

birthcountry

: birth country

movements

: movement or school of thought

Source

Own elaboration from manuals of sociology.

Examples

data(sociologists)
head(sociologists, 10)
tail(sociologists, 10)

Interactive time-bar plot.

Description

timeline_rd3 produces a timeline_rd3 object ready for its representation as an interactive time line in a web browser.

Usage

timeline_rd3(periods, name = "name", start = "start", end = "end", group = NULL,
             text = NULL, main = NULL, note = NULL, info = NULL,
             events = NULL, eventNames = "name", eventPeriod = "period",
             eventTime = "date", eventColor = NULL, eventShape = NULL,
             cex = 1, language = c("en","es","ca"), dir = NULL)

Arguments

periods

a data frame with at least three columns describing period names, start and end.

name

name of the column with names in the periods data frame.

start

name of the column with starts in the periods data frame.

end

name of the column with ends in the periods data frame.

group

name of the column with a grouping criteria in the periods data frame.

text

name of the column with a descriptive text of periods (html format) in the periods data frame.

main

upper title of the graph.

note

lower title of the graph.

info

name of the column in the periods data frame with information to display on the information panel.

events

a data frame of events related to periods (shown as dots) with three columns: interval name, event name and event date

eventNames

name of the column with event identifiers in the events data frame.

eventPeriod

name of the column with interval identifiers in the events data frame.

eventTime

name of the column with time points in the events data frame.

eventColor

name of the column with the color criteria in the events data frame.

eventShape

name of the column with the shape criteria in the events data frame.

cex

number indicating the amount by which plotting text should be scaled relative to the default.

language

a character string indicating the language of the graph (en=english (default); es=spanish; ca=catalan).

dir

a "character" string representing the directory where the web files will be saved.

Value

Object of class timeline_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

# Database of 19th century sociologists
data(sociologists)
timeline <- timeline_rd3(sociologists,"name","birth","death","birthcountry")
## Not run: 
plot(timeline)

## End(Not run)

Images in a grid gallery.

Description

treeGallery_rd3 produces an interactive image gallery.

Usage

treeGallery_rd3(tree, deep = FALSE, initialType = NULL, tableformat = FALSE, ...)

Arguments

tree

a data frame with two columns: source and target, describing relationships between nodes. It indicates a hierarchy between nodes which can be dynamically explored. Optionally, another two columns describing types can be passed.

deep

The tree is especified in a structure that preserves paths. Each column will be a tree level, colnames as node types.

initialType

A character vector indicating which node type will be shown at start. No effects in 'deep' mode.

tableformat

If the tree is especified as a table, one column per level. No effects in 'deep' mode.

...

Any gallery_rd3 argument.

Value

Object of class treeGallery_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

# simply linked tree
tree <- data.frame(
  parent=c("a","a","b","b","b","ab","ab","ab","ab","ba","ba","baa","ba"),
  child=c("aa","ab","ba","bb","bc","aba","abb","abc","abd","baa","bab","baaa","aba")
)

gallery <- treeGallery_rd3(tree)

## Not run: 
plot(gallery)

## End(Not run)


# Create some film data
tree <- data.frame(
  film = c("The Shawshank Redemption", "The Godfather", "The Dark Knight", "The Godfather Part II",
    "12 Angry Men", "Schindler's List", "The Lord of the Rings: The Return of the King",
    "Pulp Fiction", "The Lord of the Rings: The Fellowship of the Ring",
    "The Good, the Bad and the Ugly"),
  director = c("Frank Darabont", "Francis Ford Coppola", "Christopher Nolan",
    "Francis Ford Coppola", "Sidney Lumet", "Steven Spielberg", "Peter Jackson",
    "Quentin Tarantino", "Peter Jackson", "Sergio Leone"),
  actor = c("Tim Robbins|Morgan Freeman|Bob Gunton", "Marlon Brando|Al Pacino|James Caan",
    "Christian Bale|Heath Ledger|Aaron Eckhart", "Al Pacino|Robert De Niro|Robert Duvall",
    "Henry Fonda|Lee J. Cobb|Martin Balsam", "Liam Neeson|Ralph Fiennes|Ben Kingsley",
    "Elijah Wood|Viggo Mortensen|Ian McKellen", "John Travolta|Uma Thurman|Samuel L. Jackson",
    "Elijah Wood|Viggo Mortensen|Ian McKellen", "Clint Eastwood|Eli Wallach|Lee Van Cleef")
)

gallery <- treeGallery_rd3(tree, initialType="film", tableformat=TRUE, color="type", zoom=2)

## Not run: 
plot(gallery)

## End(Not run)


# example with path preservation
tree <- rbind(
c("a1","b1","c1|c2"),
c("a2","b2","c3|c4"),
c("a3","b2","c4|c5"),
c("a4","b3|b4","c6|c7|c8")
)

colnames(tree) <- c("a","b","c")

gallery <- treeGallery_rd3(tree, deep=TRUE, color="type")
## Not run: 
plot(gallery)

## End(Not run)

Images in a grid gallery.

Description

treeGallery2_rd3 produces an interactive image gallery (alternative display).

Usage

treeGallery2_rd3(tree, initialType = NULL, tableformat = FALSE, ...)

Arguments

tree

a data frame with two columns: source and target, describing relationships between nodes. It indicates a hierarchy between nodes which can be dynamically explored. Optionally, another two columns describing types can be passed.

initialType

A character vector indicating which node type will be shown at start.

tableformat

If the tree is especified as a table, one column per level.

...

Any gallery_rd3 argument.

Value

Object of class treeGallery_rd3.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca.

Examples

# Create some film data
tree <- data.frame(
  film = c("The Shawshank Redemption", "The Godfather", "The Dark Knight", "The Godfather Part II",
    "12 Angry Men", "Schindler's List", "The Lord of the Rings: The Return of the King",
    "Pulp Fiction", "The Lord of the Rings: The Fellowship of the Ring",
    "The Good, the Bad and the Ugly"),
  director = c("Frank Darabont", "Francis Ford Coppola", "Christopher Nolan",
    "Francis Ford Coppola", "Sidney Lumet", "Steven Spielberg", "Peter Jackson",
    "Quentin Tarantino", "Peter Jackson", "Sergio Leone"),
  actor = c("Tim Robbins|Morgan Freeman|Bob Gunton", "Marlon Brando|Al Pacino|James Caan",
    "Christian Bale|Heath Ledger|Aaron Eckhart", "Al Pacino|Robert De Niro|Robert Duvall",
    "Henry Fonda|Lee J. Cobb|Martin Balsam", "Liam Neeson|Ralph Fiennes|Ben Kingsley",
    "Elijah Wood|Viggo Mortensen|Ian McKellen", "John Travolta|Uma Thurman|Samuel L. Jackson",
    "Elijah Wood|Viggo Mortensen|Ian McKellen", "Clint Eastwood|Eli Wallach|Lee Van Cleef")
)

gallery <- treeGallery2_rd3(tree, initialType="film", tableformat=TRUE)

## Not run: 
plot(gallery)

## End(Not run)