Type: Package
Title: Network Explorer
Version: 0.0.2
Description: Social network analysis has become an essential tool in the study of complex systems. 'NetExplorer' allows to visualize and explore complex systems. It is based on 'd3js' library that brings 1) Graphical user interface; 2) Circular, linear, multilayer and force Layout; 3) Network live exploration and 4) SVG exportation.
License: GPL (≥ 3)
Encoding: UTF-8
Depends: R (≥ 4.0)
LazyData: true
RoxygenNote: 7.1.2
NeedsCompilation: no
Packaged: 2021-12-04 10:12:46 UTC; SSosa
Author: Sosa Sebastian [aut, cre]
Maintainer: Sosa Sebastian <s.sosa@live.fr>
Repository: CRAN
Date/Publication: 2021-12-05 14:10:11 UTC

Colorize according to a column in a data frame

Description

Add a new column to a data frame of gradient color based on a specific column of the data frame

Usage

colorize(df, col.att, color, new.col.name)

Arguments

df

a data frame

col.att

an integer indicating the column with which to create the gradient

color

a character vector of length two indicating the starting point of the gradient and the ending point of the gradiant

new.col.name

a string indicating the gradient column name added to argument df

Details

argument df with an additional column corresponding to the gradient column based on argument att.

Value

a data frame.


Data frame

Description

This is a simulated data frame of individual characteristics

Usage

df

Format

An object of class data.frame with 20 rows and 6 columns.

Author(s)

Sebastian Sosa


Find a data frame index

Description

Finds the data frame index of a column from the name of the column or its index.

Usage

df.col.findId(df, label_name)

Arguments

df

a data frame in which to find the index of (a) specific column(s).

label_name

a character or numeric vector indicating the column name or index respectively.

Details

This function allows the user to select one or several columns according to their name(s) or their index(es).

Value

an numeric vector corresponding to the column index that matches argument label_name.

Author(s)

Sebastian Sosa, Ivan Puga-Gonzalez.


Matrix data frame

Description

This is a simulated data frame of individual characteristics

Usage

m

Format

An object of class matrix (inherits from array) with 20 rows and 20 columns.

Author(s)

Sebastian Sosa


Matrix to edge list

Description

Converts a square adjacency matrix into a data frame with three columns representing an edge list. Columns are: actor, receiver and weight.

Usage

mat.to.edgl(M, sym = FALSE, erase.diag = TRUE)

Arguments

M

a square adjacency matrix.

sym

if TRUE, it extracts the lower triangle of the matrix only.

erase.diag

if TRUE, it omits diagonals.

Details

This function convert a matrix into an edgelist.

Value

a data frame representing an edge list.

Author(s)

Sebastian Sosa


Specify shapes according to a column in a data frame

Description

Specify shapes according to a column in a data frame

Usage

shape(vec, char)

Arguments

vec

a vector

char

a character vector

Details

Converts a character vector into a numeric vector.

Value

a numeric vector.


Visualize a network

Description

Plots a network

Usage

vis.net(
  df,
  m,
  col.id = NULL,
  col.size = NULL,
  color = c("black", "white"),
  col.color = NULL,
  col.shape = NULL,
  shapes = NULL,
  strokeCol = c("white", "black"),
  col.strokeCol = NULL,
  col.stroke = NULL,
  layers = NULL,
  node.opacity = NULL,
  link.opacity = FALSE,
  background = "grey"
)

Arguments

df

a data frame with node information.

m

a matrix of node connections.

col.id

a character or numeric vector indicating the column name or index of node Ids.

col.size

a character or numeric vector indicating the column name or index of node size.

color

a vector character of length two indicating the range of color for node color.

col.color

a character or numeric vector indicating the column name or index of node color.

col.shape

a character or numeric vector indicating the column name or index of node shape.

shapes

a character vector indicating the type of shape per category. 7 shapes are available: "circle", "cross", "diamond", "rectangle, "star", "triangle", "y"

strokeCol

a vector character of length two indicating the range of color for node stroke color.

col.strokeCol

a character or numeric vector indicating the column name or index of node stroke color.

col.stroke

a character or numeric vector indicating the column name or index of node stroke.

layers

a column in argument df indicating the factor to use for multi-layer layout.

node.opacity

a character or numeric vector indicating the column name or index of node opacity.

link.opacity

a character or numeric vector indicating the column name or index of link opacity.

background

a character indicating the background color.

Details

Opens default web browser and shows 'NetExplorer' interface with the desired network. Further information and tutorial can be found in my video https://youtu.be/IcFTZWCTO_s/

Value

Opens default web browser with the ploted network.

Author(s)

Sebastian Sosa

Examples

vis.net(df,m,col.id = "id", col.size = "strength",
color = c('green', 'yellow'), col.color = "age" ,
strokeCol = c('red', 'blue'), col.strokeCol = "kinship",
col.stroke = "degree",
col.shape =  "sex",shapes = c("circle", "triangle"),
layers =  "kinship")

specifies shapes according to a column in a data frame

Description

specifies shapes according to a column in a data frame

Usage

vis.net.format.att(
  df,
  col.id = NULL,
  col.size = NULL,
  color = NULL,
  col.color = NULL,
  shapes = NULL,
  col.shape = NULL,
  strokeCol = NULL,
  col.strokeCol = NULL,
  col.stroke = NULL,
  node.opacity = NULL
)

Arguments

df

a data frame with node information.

col.id

a character or numeric vector indicating the column name or index of node Ids.

col.size

a character or numeric vector indicating the column name or index of node size.

color

a vector character of length two indicating the range of color for node color.

col.color

a character or numeric vector indicating the column name or index of node color.

shapes

a character vector indicating the type of shape per category. 7 shapes are available: "circle", "cross", "diamond", "rectangle, "star", "triangle", "y"

col.shape

a character or numeric vector indicating the column name or index of node shape.

strokeCol

a vector character of length two indicating the range of color for node stroke color.

col.strokeCol

a character or numeric vector indicating the column name or index of node stroke color.

col.stroke

a character or numeric vector indicating the column name or index of node stroke.

node.opacity

a character or numeric vector indicating the column name or index of node opacity.

Details

format a data frame with informations relative to vis.net function.

Value

a data frame.