network_rd3: Interactive network.

View source: R/network.R

network_rd3R Documentation

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:4,
        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. 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)

rD3plot documentation built on March 31, 2023, 7:15 p.m.