Title: | Interactive Analytic Networks |
---|---|
Description: | Create interactive analytic networks. It joins the data analysis power of R to obtain coincidences, co-occurrences and correlations, and the visualization libraries of 'JavaScript' in one package. |
Authors: | Modesto Escobar [cre, aut, cph]
|
Maintainer: | Modesto Escobar <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 2.1.2 |
Built: | 2025-02-07 16:33:43 UTC |
Source: | https://github.com/modesto-escobar/netcoin-2.x |
Create interactive networked coincidences. It joins the data analysis power of R to study coincidences and the visualization libraries of JavaScript in one package.
Coincidence analysis detects what events, characters, objects, attributes, or characteristics tend to occur together within certain limits.
These given limits are call scenarios () and are considered to be the units of analysis, and as such they have to be placed in the rows of a matrix or data.frame.
In each scenario, a series of
events
, which are to be represented as dichotomous variables
in columns, may occur (1) or may not occur (0). Scenarios and events constitute an incidence matrix (I).
Incidence matrix
|
|
|
... |
|
|
|
0 | 1 | 0 | ... | 1 |
|
1 | 0 | 1 | ... | 0 |
... | ... | ... | ... | ... | ... |
|
1 | 1 | 0 | ... | 1 |
From this incidences matrix, a coincidence (C) matrix can be obtained with the function coin
. In this matrix the main diagonal represents frequencies of , while the others elements are number of coincidences between two events.
Coincidence matrix
|
|
|
|
|
|
|
2 | 1 | 1 | ... | 1 |
|
1 | 2 | 0 | ... | 2 |
|
1 | 0 | 1 | ... | 0 |
... | ... | ... | ... | ... | ... |
|
1 | 2 | 0 | ... | 2 |
Once there is a coin
object, a similarity matrix can be obtained. Similarity matrices available in netCoin are:
Matching (m), Rogers & Tanimoto (t) Gower (g) Sneath (s) and Anderberg (and).
Jaccard (j), dice (d), antiDice (a), Ochiai (o) and Kulczynski (k).
Hamann (ham), Yule (y), Pearson (p), odds ratio (od) and Rusell (r).
Other measures that can be obtained from coin
are:
Relative frequencies (x), conditional frequencies (i) coincidence degree (cc) and probable degree of coincidence (cp).
Haberman (h) and Z value of Haberman (z)
To obtain similarity and other measures matrices, the function sim
elaborates a list of them.
Similarity matrix
|
|
|
|
|
|
|
1.73 | -.87 | .87 | ... | -.87 |
|
-.87 | 1.73 | -1.73 | ... | 1.73 |
|
.87 | -1.73 | 1.73 | ... | -1.73 |
... | ... | ... | ... | ... | ... |
|
-.87 | 1.73 | -1.73 | ... | 1.73 |
edgeList
makes a collecion of edges composed by a list of similarity measures whenever a criterium (generally p(Z)<.50) is met.
Edge list
source | target | Haberman | P(z) | |
1 | X1 | X3 | 0.8660254 | 0.22509243 |
2 | X2 | X4 | 1.7320508 | 0.09084506 |
In order to make a graph, two data frames are needed: a nodes data frames with names and other nodes attributes (see asNodes
) and an edge data frame (see edgeList
). For more information go to netCoin
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. (2009): "Redes Semanticas en Textos Periodisticos: Propuestas Tecnicas para su Representacion", en Empiria, 17, 13-39.
Escobar, M.(2015): "Studying Coincidences with Network Analysis and Other Multivariate Tools", in The Stata Journal, 15(4), 1118-1156.
Escobar, M. and J. Gomez Isla (2015): "The Expression of Identity through the Image: The Photographic Archives of Miguel de Unamuno and Joaquin Turina", en Revista Espanola de Investigaciones Sociologicas, 152, 23-46.
addDescription
adds a description to a 'netCoin' object.
addDescription(x, description)
addDescription(x, description)
x |
A 'netCoin' object. |
description |
the description text. |
A 'netCoin' object.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
data(finches) data(Galapagos) Net<-allNet(Galapagos,nodes=finches, criteria="hyp", maxL=.05, lwidth ="Haberman",lweight="Haberman", size="frequency", color="species", layout="mds", main="Species coincidences in Galapagos Islands", note="Data source: Sanderson (2000)") img <- system.file("extdata", "p.Crassirostris.png", package="netCoin") Net <- addDescription(Net,"Species coincidences in Galapagos Islands") ## Not run: multi <- multigraphCreate(Network=Net) multiPages(multi,"Graph description example",show=TRUE) ## End(Not run)
data(finches) data(Galapagos) Net<-allNet(Galapagos,nodes=finches, criteria="hyp", maxL=.05, lwidth ="Haberman",lweight="Haberman", size="frequency", color="species", layout="mds", main="Species coincidences in Galapagos Islands", note="Data source: Sanderson (2000)") img <- system.file("extdata", "p.Crassirostris.png", package="netCoin") Net <- addDescription(Net,"Species coincidences in Galapagos Islands") ## Not run: multi <- multigraphCreate(Network=Net) multiPages(multi,"Graph description example",show=TRUE) ## End(Not run)
addImage
adds an image to a 'netCoin' object.
addImage(x, img)
addImage(x, img)
x |
A 'netCoin' object. |
img |
character vector indicating the image path. |
A 'netCoin' object.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
data(finches) data(Galapagos) Net<-allNet(Galapagos,nodes=finches, criteria="hyp", maxL=.05, lwidth ="Haberman",lweight="Haberman", size="frequency", color="species", layout="mds", main="Species coincidences in Galapagos Islands", note="Data source: Sanderson (2000)") img <- system.file("extdata", "p.Crassirostris.png", package="netCoin") Net <- addImage(Net,img) ## Not run: multi <- multigraphCreate(Network=Net) multiPages(multi,"Graph image example",show=TRUE) ## End(Not run)
data(finches) data(Galapagos) Net<-allNet(Galapagos,nodes=finches, criteria="hyp", maxL=.05, lwidth ="Haberman",lweight="Haberman", size="frequency", color="species", layout="mds", main="Species coincidences in Galapagos Islands", note="Data source: Sanderson (2000)") img <- system.file("extdata", "p.Crassirostris.png", package="netCoin") Net <- addImage(Net,img) ## Not run: multi <- multigraphCreate(Network=Net) multiPages(multi,"Graph image example",show=TRUE) ## End(Not run)
addNetCoin
changes netCoin object attributes.
addNetCoin(x, ...)
addNetCoin(x, ...)
x |
A 'netCoin' object. |
... |
Any netCoin argument. |
This function returns a netCoin
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame net <- netCoin(N, E) # netCoin object net <- addNetCoin(net, color="frequency") # netCoin object with color applied to nodes
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame net <- netCoin(N, E) # netCoin object net <- addNetCoin(net, color="frequency") # netCoin object with color applied to nodes
addTutorial
adds a tutorial for a gallery.
addTutorial(x, image = NULL, description = NULL)
addTutorial(x, image = NULL, description = NULL)
x |
object of class |
image |
character vector indicating the image path, header for the tutorial. |
description |
a character string indicating a desription text to insert in the tutorial. |
Object of class gallery_rd3
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field g <- gallery(finches, image="species", main="Species in Galapagos Islands", note="Data source: Sanderson (2000)") g <- addTutorial(g, description="Here you can see different finches species in Galapagos islands.") ## Not run: plot(g) ## End(Not run)
data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field g <- gallery(finches, image="species", main="Species in Galapagos Islands", note="Data source: Sanderson (2000)") g <- addTutorial(g, description="Here you can see different finches species in Galapagos islands.") ## Not run: plot(g) ## End(Not run)
allNet
produces a network object of coincidences from a data frame or a matrix with dichotomous values.
allNet(incidences, weight = NULL, subsample = FALSE, pairwise = FALSE, minimum=1, maximum = nrow(incidences), sort = FALSE, decreasing = TRUE, frequency = FALSE, percentages = TRUE, procedures = "Haberman", criteria = "Z", Bonferroni = FALSE, support = -Inf, minL = -Inf, maxL = Inf, directed = FALSE, diagonal = FALSE, sortL = NULL, decreasingL = TRUE, igraph = FALSE, dir=NULL, ...)
allNet(incidences, weight = NULL, subsample = FALSE, pairwise = FALSE, minimum=1, maximum = nrow(incidences), sort = FALSE, decreasing = TRUE, frequency = FALSE, percentages = TRUE, procedures = "Haberman", criteria = "Z", Bonferroni = FALSE, support = -Inf, minL = -Inf, maxL = Inf, directed = FALSE, diagonal = FALSE, sortL = NULL, decreasingL = TRUE, igraph = FALSE, dir=NULL, ...)
incidences |
an incidence matrix or data frame with only 0/1 variables. |
weight |
a vector of weights. Optimal for data.framed tables. |
subsample |
retrict the analysis to scenarios with at least one event. |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
minimum |
minimum frequency to be considered. |
maximum |
maximum frequency to be considered. |
sort |
sort the coincidence matrix according to frequency of events. |
decreasing |
decreasing or increasing sort of the matrix. |
frequency |
a logical value true if frequencies are to be shown. Default = FALSE. |
percentages |
a logical value true if percentages are to be shown. Default = TRUE. |
procedures |
a vector of statistics of similarity. See below. |
criteria |
statistic to be use for selection criteria. |
Bonferroni |
Bonferroni criterium of the signification test. |
support |
minimum value of the frequency of the coincidence to be edged. |
minL |
minimum value of the statistic to include the edge in the list. |
maxL |
maximum value of the statistic to include the edge in the list. |
directed |
includes same edges only once. |
diagonal |
includes auto-links. |
sortL |
sort the list according to the values of a statistic. See below. |
decreasingL |
order in a decreasing way. |
igraph |
Produces an igraph object instead of a netCoin object if TRUE. |
dir |
a "character" string representing the directory where the web files will be saved. |
... |
Any netCoin argument. |
Possible measures in procedures are
Frequencies (f), Relative frequencies (x), Conditional frequencies (i), Coincidence degree (cc), Probable degree (cp),
Expected (e), Confidence interval (con)
Matching (m), Rogers & Tanimoto (t), Gower (g), Sneath (s), Anderberg (and),
Jaccard (j), Dice (d), antiDice (a), Ochiai (o), Kulczynski (k),
Hamann (ham), Yule (y), Pearson (p), odds ratio (od), Rusell (r),
Haberman (h), Z value of Haberman (z),
Hypergeometric p greater value (hyp).
Convert a matrix into an edge list (shape).
This function creates a netCoin object (or igraph) and, if stated, 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] allNet(data) # network object
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] allNet(data) # network object
asGallery
produces a gallery_rd3 object.
asGallery(net)
asGallery(net)
net |
is a |
Object of class gallery_rd3
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
data("Galapagos") data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field Net <- allNet(Galapagos, nodes=finches, criteria="hyp", maxL=.05, image="species", main="Species coincidences in Galapagos Islands", note="Data source: Sanderson (2000)") gallery <- asGallery(Net)
data("Galapagos") data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field Net <- allNet(Galapagos, nodes=finches, criteria="hyp", maxL=.05, image="species", main="Species coincidences in Galapagos Islands", note="Data source: Sanderson (2000)") gallery <- asGallery(Net)
Nodes data frame from either an edge list or a coin
object.
asNodes(C, frequency = TRUE, percentages = FALSE, language = c("en","es","ca"))
asNodes(C, frequency = TRUE, percentages = FALSE, language = c("en","es","ca"))
C |
has to be an edge list or, better, a |
frequency |
add frequency of nodes |
percentages |
add nodes percentages |
language |
a character vector (es=spanish; en=english; ca=catalan). |
A data frame with nodes' names and their frequency and/or percentages if the input is a coin
object
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# From a random incidence matrix I(25X4) I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) C <- coin(I) asNodes(C)
# From a random incidence matrix I(25X4) I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) C <- coin(I) asNodes(C)
barCoin
produces a barCoin object.
barCoin(data, variables = colnames(data), commonlabel = NULL, dichotomies = c("_all","_none"), valueDicho = 1, weight = NULL, subsample = FALSE, sort = NULL, decreasing = TRUE, nodes = NULL, name = NULL, select = NULL, scalebar = FALSE, note = NULL, label = NULL, text = NULL, color = NULL, defaultColor = "#1f77b4", expected = FALSE, confidence = FALSE, level = .95, significance = FALSE, minimum = 1 , maximum = nrow(data), percentages = FALSE, criteria = c("Z","hyp"), Bonferroni = FALSE, support = 1, minL = -Inf, maxL = 1, language = c("en","es","ca"), cex = 1.0, dir = NULL)
barCoin(data, variables = colnames(data), commonlabel = NULL, dichotomies = c("_all","_none"), valueDicho = 1, weight = NULL, subsample = FALSE, sort = NULL, decreasing = TRUE, nodes = NULL, name = NULL, select = NULL, scalebar = FALSE, note = NULL, label = NULL, text = NULL, color = NULL, defaultColor = "#1f77b4", expected = FALSE, confidence = FALSE, level = .95, significance = FALSE, minimum = 1 , maximum = nrow(data), percentages = FALSE, criteria = c("Z","hyp"), Bonferroni = FALSE, support = 1, minL = -Inf, maxL = 1, language = c("en","es","ca"), cex = 1.0, dir = NULL)
data |
a data frame |
variables |
a vector of variables included in the previous data frame |
commonlabel |
a vector of variables whose names are to be included in nodes labels |
dichotomies |
a vector of dichotomous variables to appear as just one categorie |
valueDicho |
value to be selected for dichotomous variables. Default is 1 |
weight |
a vector of weights. Optimal for data.framed tables. |
subsample |
retrict the analysis to scenarios with at least one event. |
sort |
name of the vector in the nodes data frame to order the graph. |
decreasing |
decreasing or increasing sort of the graph order. |
nodes |
a data frame with at least two vectors of names and incidences. |
name |
name of the vector with names in the nodes data frame. |
select |
Name of the event (in nodes name column) to start the visualization. |
scalebar |
Should the bars fill the screen height? Default = FALSE. |
note |
lower title of the graph. |
label |
name of the vector with labels in the nodes data frame. |
text |
name of the vector with html text in the nodes data frame. |
color |
name of the vector with color variable in the nodes data frame. |
defaultColor |
a character vector giving a valid html color. |
expected |
name of the vector with expected coincidences in the links data frame. |
confidence |
name of the vector with confidence interval in the links data frame. |
level |
confidence level |
significance |
name of the vector with significance in the links data frame. |
minimum |
minimum frequency to be considered. |
maximum |
maximum frequency to be considered. |
percentages |
a logical value true if percentages are to be shown. Default = TRUE. |
criteria |
statistic to be use for selection criteria. |
Bonferroni |
Bonferroni criterium of the signification test. |
support |
minimum value of the frequency of the coincidence to be edged. |
minL |
minimum value of the statistic to include the edge in the list. |
maxL |
maximum value of the statistic to include the edge in the list. |
language |
a character vector (es=spanish; en=english; ca=catalan). |
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 web files will be saved. |
Object of class barCoin
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] barCoin(data,dichotomies="_all") barCoin(data,dichotomies="_all",confidence=TRUE,percentages=TRUE)
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] barCoin(data,dichotomies="_all") barCoin(data,dichotomies="_all",confidence=TRUE,percentages=TRUE)
This function calculates the centrality measures of a network.
calCentr(graph, measures = c("degree","wdegree","closeness","betweenness","eigen"), order = "")
calCentr(graph, measures = c("degree","wdegree","closeness","betweenness","eigen"), order = "")
graph |
A |
measures |
Character vector of the measures to be calculated (See details). |
order |
Sort the data.frame by the different measures. |
This function reproduces some of the most significant classic Social Network Theory's centrality measures. See Wasserman (1994), Freeman (1978), or Bonacich & Lloyd (2001) to know more.
a) Degree = Degree centrality is measured by the total amount of direct links with the other nodes.
b) Closeness = Closeness centrality is meant to measure one node to the others nodes' sum distances
c) Betweenness = Betweenness centrality measures one node undertaking "mediation" role in a network.
d) Eigen = Eigenvector centrality measures a node's importance while giving consideration to the importance of its neighbors.
By default, measures = "all", thus all the measures will be calculated. The function can be applied to an igraph or a netCoin object. In case the graph is undirected, it will show the degree, weighted degree, closeness, betweeness and eigen degree. Moreover, if it us directed, it will show the indegree, windegree and outdegree, both weighted and unweighted (See example.).
This function creates a list containing two elements: 1) a data.frame (nodes) with all the centrality measures applied to the graph and 2) another data.frame (graph) with this measures applied to the whole network.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame G <- netCoin(N, E, showArrows=TRUE) # netCoin object calCentr(G, "all")
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame G <- netCoin(N, E, showArrows=TRUE) # netCoin object calCentr(G, "all")
caring
produce an interactive multi graph from caring arguments.
caring(filepath,arguments)
caring(filepath,arguments)
filepath |
The path to the data file. |
arguments |
a list with the caring exported arguments. |
This function returns a mGraph
object.
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
## Not run: filename <- "demo.sav" arguments <- list( variables = c("Gender", "Income category in thousands", "Primary vehicle price category"), plot = "network" ) graph <- caring(filename,arguments) plot(graph) ## End(Not run)
## Not run: filename <- "demo.sav" arguments <- list( variables = c("Gender", "Income category in thousands", "Primary vehicle price category"), plot = "network" ) graph <- caring(filename,arguments) plot(graph) ## End(Not run)
caring_create_graphs
produce an interactive multi graph from caring arguments.
caring_create_graphs(data,arguments)
caring_create_graphs(data,arguments)
data |
A data frame. |
arguments |
a list with the caring exported arguments. |
This function returns a mGraph
object.
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
data <- data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) arguments <- list( variables = c("Gender", "Opinion"), dichotomies = "Opinion", valueDicho = "Yes", plot = c("surCoin","network") ) graph <- caring_create_graphs(data,arguments) ## Not run: plot(graph) ## End(Not run)
data <- data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) arguments <- list( variables = c("Gender", "Opinion"), dichotomies = "Opinion", valueDicho = "Yes", plot = c("surCoin","network") ) graph <- caring_create_graphs(data,arguments) ## Not run: plot(graph) ## End(Not run)
caring_read_file
reads sav, dta, xlsx, tsv and csv files and prepares data for caring.
caring_read_file(filepath)
caring_read_file(filepath)
filepath |
The path to the data file. |
This function returns a data frame.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
## Not run: filename <- "demo.sav" data <- caring_read_file(filename) ## End(Not run)
## Not run: filename <- "demo.sav" data <- caring_read_file(filename) ## End(Not run)
cobCoin
produces a netCoin object to graph a CoWeb graphic (Upton 2000).
cobCoin(data, variables=names(data), degree=0, significance=.05, ...)
cobCoin(data, variables=names(data), degree=0, significance=.05, ...)
data |
a data frame. |
variables |
a vector of variables included in the previous data frame. |
degree |
degree to rotate the categories of the graph |
significance |
p value maximum to represent the links |
... |
This function creates a netCoin object (or igraph) and, if stated, 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Upton, Graham J.G. (2000) Cobweb diagrams for multiway contingency tables. The Statistician, 49(1), 79-85.
# A data frame with two variables Gender and Opinion frame <- data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) cobCoin(frame, significance=.5, degree=45) # netCoin object # A data frame with two variables (Gender and Hand) and nodes input <- data.frame( Gender = c("Women", "Men", "Men", "Women", "Women","Men", "Men", "Men", "Women", "Women", "Men", "Women"), Hand = c("Right", "Left","Right", "Right", "Right", "Right", "Left", "Right", "Right", "Left","Right", "Right")) nodes <- data.frame( name = c("Gender:Men","Gender:Women", "Hand:Left", "Hand:Right"), label = c("Women(50\u25)","Men(50\u25)", "Left hand(25\u25)", "Right hand(75\u25)")) G <- cobCoin(input, nodes=nodes, label="label", degree=22.5, showArrows=TRUE, significance=1)
# A data frame with two variables Gender and Opinion frame <- data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) cobCoin(frame, significance=.5, degree=45) # netCoin object # A data frame with two variables (Gender and Hand) and nodes input <- data.frame( Gender = c("Women", "Men", "Men", "Women", "Women","Men", "Men", "Men", "Women", "Women", "Men", "Women"), Hand = c("Right", "Left","Right", "Right", "Right", "Right", "Left", "Right", "Right", "Left","Right", "Right")) nodes <- data.frame( name = c("Gender:Men","Gender:Women", "Hand:Left", "Hand:Right"), label = c("Women(50\u25)","Men(50\u25)", "Left hand(25\u25)", "Right hand(75\u25)")) G <- cobCoin(input, nodes=nodes, label="label", degree=22.5, showArrows=TRUE, significance=1)
coexist
Interactive network of time coexistences of periods.coexist
produces interactive graphs representing coexistence. Two periods or lifes coexist if they share a given number of years.
coexist(periods, name="name", start="start", end="end", fields=names(periods), plusstart=0, minusend=0, igraph=FALSE, ...)
coexist(periods, name="name", start="start", end="end", fields=names(periods), plusstart=0, minusend=0, igraph=FALSE, ...)
periods |
a data frame with at least three vectors with name, start and end of the periods. |
name |
name of the vector with names in the periods data frame. |
start |
name of the vector with starts in the periods data frame. |
end |
name of the vector with ends in the periods data frame. |
fields |
vector of the names of the periods data frame to be taken into account. |
plusstart |
number of years to be trimmed at the beginning of each period. |
minusend |
number of years to be trimmed at the end of each period. |
igraph |
produces an igraph object instead of a netCoin class. |
... |
Any netCoin argument. |
Two periods coexists if they have at least one year in common. Periods can be trimmed at the begining or at the end.
This function creates a netCoin object (or igraph) and, if plotted, 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.
A netCoin object has three elements:
nodes |
A data frame with the periods. |
links |
A data frame with the events. |
options |
A list of options for the interactive graph. |
Periods could be the life of people, in whose case start is their birth and end their death year.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# With sociologists data. data(sociologists) # Produce an igraph object: coexist(sociologists, start="birth", end="death", igraph=TRUE) # Omit as coexistence the 15 firts years of life: sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") # copy path to the picture field coexist(sociologists, start="birth", end="death", plusstart=15, image="picture", imageName="name")
# With sociologists data. data(sociologists) # Produce an igraph object: coexist(sociologists, start="birth", end="death", igraph=TRUE) # Omit as coexistence the 15 firts years of life: sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") # copy path to the picture field coexist(sociologists, start="birth", end="death", plusstart=15, image="picture", imageName="name")
A coin object is a squared matrix of coincidences with its names and the frequency of events as attributes.
coin(incidences, minimum = 1, maximum = nrow(incidences), sort = FALSE, decreasing = TRUE, total = FALSE, subsample = FALSE, weight = NULL, pairwise = FALSE)
coin(incidences, minimum = 1, maximum = nrow(incidences), sort = FALSE, decreasing = TRUE, total = FALSE, subsample = FALSE, weight = NULL, pairwise = FALSE)
incidences |
an incidence matrix or data frame with only 0/1 variables |
minimum |
minimum frequency to be considered |
maximum |
maximum frequency to be considered |
sort |
sort the coincidence matrix according to frequency of events |
decreasing |
decreasing or increasing sort of the matrix |
total |
add one first row and column with total |
subsample |
retrict the analysis to scenarios with at least one event |
weight |
a vector of weights. Optimal for data.framed tables |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
Produce a matrix of coincidences from a matrix of incidences.
An object of coin
class
n |
Number of scenarios (rows of the incidence matrix) |
f |
Coincidence matrix |
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
## Random incidence matrix: 25 scenarios, 4 events. I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) coin(I, sort = TRUE) ## Hair by Eye by Sex table from M. Friendly (2000) data(HairEyeColor) H<-as.data.frame(HairEyeColor) W<-H$Freq I<-dichotomize(H,c("Hair","Eye","Sex"),add=FALSE) coin(I,w=W)
## Random incidence matrix: 25 scenarios, 4 events. I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) coin(I, sort = TRUE) ## Hair by Eye by Sex table from M. Friendly (2000) data(HairEyeColor) H<-as.data.frame(HairEyeColor) W<-H$Freq I<-dichotomize(H,c("Hair","Eye","Sex"),add=FALSE) coin(I,w=W)
A coocurrence object consists of a matrix with the number of ocurrences in its main diagonal and the number of coocurrences outside this diagonal. Besides, this object has two attributes: 1) n is the total of the sum of the ocurrences in each row.2) m is the sum of the maximum number of ocurrences in each row.
coocur(ocurrences, minimum = 1, maximum = Inf, sort = FALSE, decreasing = TRUE)
coocur(ocurrences, minimum = 1, maximum = Inf, sort = FALSE, decreasing = TRUE)
ocurrences |
an ocurrence matrix or data frame |
minimum |
minimum frequency to be considered |
maximum |
maximum frequency to be considered |
sort |
sort the coincidence matrix according to frequency of events |
decreasing |
decreasing or increasing sort of the matrix |
Produce a matrix of coocurrences from a matrix of occurences.
An object of cooc
class with a coocurrence matrix. It has two attributes:
n |
Total sum of occurences) |
m |
Sum of maximum occurences in each row of the ocurrence matrix |
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Tossing two coins five times. D<-data.frame(Head=c(2,1,1,0,2),Tail=c(0,1,1,2,0)) coocur(D)
## Tossing two coins five times. D<-data.frame(Head=c(2,1,1,0,2),Tail=c(0,1,1,2,0)) coocur(D)
netCorr
produces a network object of dynamic correlations. Its input has to be at least one set of quantitative variables.
d_netCorr(variables, nodes = NULL, weight=NULL, pairwise=FALSE, minimum=-Inf, maximum=Inf, frequency=FALSE, means=TRUE, method=c("pearson", "kendall", "spearman"), criteria="value", Bonferroni=FALSE, minL=0, maxL=Inf, sortL=NULL, decreasingL=TRUE, factorial=c("null", "pc", "nf", "vf", "of"), components=TRUE, backcomponents=FALSE, sequence=seq(.20, 1, .01), textFilter=c(1, .99), speed=50, dir=NULL, ...)
d_netCorr(variables, nodes = NULL, weight=NULL, pairwise=FALSE, minimum=-Inf, maximum=Inf, frequency=FALSE, means=TRUE, method=c("pearson", "kendall", "spearman"), criteria="value", Bonferroni=FALSE, minL=0, maxL=Inf, sortL=NULL, decreasingL=TRUE, factorial=c("null", "pc", "nf", "vf", "of"), components=TRUE, backcomponents=FALSE, sequence=seq(.20, 1, .01), textFilter=c(1, .99), speed=50, dir=NULL, ...)
variables |
a data frame with at least two quantitative variables. |
nodes |
a data frame with at least one vector of names and other information from the nodes |
weight |
a vector of weights. Optimal for data.framed tables |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
minimum |
minimum mean to be considered |
maximum |
maximum mean to be considered |
frequency |
a logical value true if frequencies are to be shown. Default=FALSE. |
means |
a logical value true if means are to be shown. Default=TRUE. |
method |
a vector of statistics of similarity. Pearson correlation by default. Spearman and Kendall are also possible |
criteria |
statistic to be use for selection criteria. |
Bonferroni |
Bonferroni criterium of the signification test. |
minL |
minimum value of the statistic to include the edge in the list. |
maxL |
maximum value of the statistic to include the edge in the list. |
sortL |
sort the list according to the values of a statistic. See below |
decreasingL |
order in a decreasing way. |
factorial |
factorial layout: Principal components (pc), factorial (nf), factorial with varimax rotation (vf), and factorial with oblimin rotation (of) are possible |
components |
display following graph in sequence only when the components are unequal |
backcomponents |
display following graph in sequence even if there are less components |
sequence |
evolution of the dinamic graphs. c(first threshold, last threshold, step) |
textFilter |
limits for showing the correlations as text on the graph. This limit is the minimun value of the first (absolute), and the second (threshold plus its value) |
speed |
speed of the dynamic evolution from 0 to 100 |
dir |
a "character" string representing the directory where the web files will be saved. |
... |
any netCoin argument. |
The function creates a list object to create a multigraph and eventually a folder in the computer with an HTML document named index.html which contains the produced dynamic graphs. This file can be directly opened with your browser and sent to a web server to work properly.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) data(iris) d_netCorr(iris[,1:4],ltext="value", sequence=seq(.80, 1, .05), zoom=3, textFilter=.85, main="Correlations between measurements of Iris Species", components=FALSE, note="Anderson, Edgar (1935) y Fisher, R. A. (1936)") # network object
# A character column (with separator) data(iris) d_netCorr(iris[,1:4],ltext="value", sequence=seq(.80, 1, .05), zoom=3, textFilter=.85, main="Correlations between measurements of Iris Species", components=FALSE, note="Anderson, Edgar (1935) y Fisher, R. A. (1936)") # network object
Data frame with events as result.
data("dice")
data("dice")
A data frame with 100 observations (scenarios) on the following 11 variables (events):
dice
: a numeric vector, representing dice results
1
: a dichotomous vector of the elemental event "1"
2
: a dichotomous vector of the elemental event "2"
3
: a dichotomous vector of the elemental event "3"
4
: a dichotomous vector of the elemental event "4"
5
: a dichotomous vector of the elemental event "5"
6
: a dichotomous vector of the elemental event "6"
odd
: a dichotomous vector of odd events
even
: a dichotomous vector of even events
small
: a dichotomous vector of small number events
large
: a dichotomous vector of large number events
Random extraction via sample(1:6,100,replace=TRUE)
See events.
data(dice) head(dice,10)
data(dice) head(dice,10)
This converts factor(s) o character(s) column(s) of a data frame into a set of dichotomous columns. Their names will correspond to the labels or text of every category.
dichotomize(data, variables, sep = "", min = 1, length = 0, values = NULL, sparse = FALSE, add = TRUE, sort = TRUE, nas = "None")
dichotomize(data, variables, sep = "", min = 1, length = 0, values = NULL, sparse = FALSE, add = TRUE, sort = TRUE, nas = "None")
data |
a data frame with a factor or textual column which can be simple (only one value for each scenario) or multiple if components are delinited with a separator. |
variables |
vector of column names that have to be converted into dichotomous vectors. |
sep |
vector of characters used to divide columns with multiple events. If this separator is "", every unique cell of every column is converted into a dichotomus data frame's column. |
min |
convert to dichotomous vectors only label or text that has a frequency less or equal to the value of this parameter. If the value of min is between 0 and 1, its value is interpreted as a percentage |
length |
maximum number of dichotomous columns generated for every variable |
values |
vector of labels or texts selected to their conversion to dichotomous columns |
sparse |
produce a sparse matrix instead of a data.frame |
add |
add the new columns to the input data.frame |
sort |
order the new columns by their frequencies |
nas |
variable name to convert the NA values of the set of variables |
A data frame composed by the original plus the added dichotmous columns.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca, and Luis Martinez Uribe, Fundacion Juan March. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A character column frame1 <- data.frame(A = c("Man", "Women", "Man", "Undet.")) dichotomize(frame1, "A", sep = "; ") # A character column (with separator) frame2 <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) dichotomize(frame2, "A", sep = "; ") # A character column and another factor column (same sepatator) frame3 <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man"), C = factor(c(1:4), labels = c("Paris", "New York", "London; New York", "<NA>"))) dichotomize(frame3, c("A", "C"), sep = "; ") # A set of simple character or factor (same levels) variables. # In this case, you must use "C" separator. frame4 <- data.frame(A = c("Man", "Women","Man", "Undet",NA), B = c("Women","Women","Man","Women",NA), C = c(NA,NA,NA,"Man",NA)) dichotomize(frame4,c("A","B","C"), sep="C")
# A character column frame1 <- data.frame(A = c("Man", "Women", "Man", "Undet.")) dichotomize(frame1, "A", sep = "; ") # A character column (with separator) frame2 <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) dichotomize(frame2, "A", sep = "; ") # A character column and another factor column (same sepatator) frame3 <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man"), C = factor(c(1:4), labels = c("Paris", "New York", "London; New York", "<NA>"))) dichotomize(frame3, c("A", "C"), sep = "; ") # A set of simple character or factor (same levels) variables. # In this case, you must use "C" separator. frame4 <- data.frame(A = c("Man", "Women","Man", "Undet",NA), B = c("Women","Women","Man","Women",NA), C = c(NA,NA,NA,"Man",NA)) dichotomize(frame4,c("A","B","C"), sep="C")
Convert a similarity matrix into a distance matrix.
distant(s, t = FALSE)
distant(s, t = FALSE)
s |
a similarity matrix |
t |
return the same matrix if t=FALSE |
For better resultas, use the parameter distance in sim
function.
A distance matrix.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# From a random incidence matrix I(25X4) I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) J <- sim(I, "Jaccard") distant(J, t = TRUE) #Same results sim(I, "Jaccard", distance = TRUE)
# From a random incidence matrix I(25X4) I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) J <- sim(I, "Jaccard") distant(J, t = TRUE) #Same results sim(I, "Jaccard", distance = TRUE)
dyncohort
produces interactive graphs representing dynamic cohorts. Two periods or lifes belongs to the same cohort if there are a difference of years in their start less or equal to a given number. In case of people's life, 15 or 25 are appropiate quantities to set. If year is equal to 0, a cohort is defined a those periods or lifes that begin at the same year.
dyncohort(periods, name="name", start="start", fields=names(periods), years=0, igraph=FALSE, ...)
dyncohort(periods, name="name", start="start", fields=names(periods), years=0, igraph=FALSE, ...)
periods |
a data frame with at least two vectors with name and start of the periods or lives. |
name |
name of the vector with names in the data frame. |
start |
name of the vector with starts in the data frame. |
fields |
vector of the names of the periods data frame to be taken into account. |
years |
number of years to be considered as length of the cohort. |
igraph |
produces an igraph object instead of a netCoin class. |
... |
Any netCoin argument. |
This function creates a timeCoin object (or igraph) and, if plotted, 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.
A netCoin object has three elements:
nodes |
A data frame with the periods. |
links |
A data frame with the events. |
options |
A list of options for the interactive graph. |
Periods could be the life of people, in whose case start is their birth year.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# With sociologists data. data(sociologists) dyncohort(sociologists, start="birth") # Condider 15 year dynamic cohort: sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") # copy path to the picture field dyncohort(sociologists, start="birth", year=15, image="picture", imageName="name")
# With sociologists data. data(sociologists) dyncohort(sociologists, start="birth") # Condider 15 year dynamic cohort: sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") # copy path to the picture field dyncohort(sociologists, start="birth", year=15, image="picture", imageName="name")
Convert a coincidence/similarity/distance matrix into an edge list form.
edgeList(data, procedures="Haberman", criteria="Z", level=.95, Bonferroni=FALSE, min=-Inf, max=Inf, support=-Inf, directed=FALSE, diagonal=FALSE, sort=NULL, decreasing=TRUE, pairwise=FALSE)
edgeList(data, procedures="Haberman", criteria="Z", level=.95, Bonferroni=FALSE, min=-Inf, max=Inf, support=-Inf, directed=FALSE, diagonal=FALSE, sort=NULL, decreasing=TRUE, pairwise=FALSE)
data |
a coin object, let's say an R matrix with frequencies and an attribute ( |
procedures |
a vector of statistics of similarity. See below. |
criteria |
statistic to be use for selection criteria. |
level |
confidence level |
Bonferroni |
Bonferroni criterium of the signification test. |
min |
minimum value of the statistic to include the edge in the list. |
max |
maximum value of the statistic to include the edge in the list. |
support |
minimum value of the frequency of the coincidence to be edged |
directed |
includes same edges only once. |
diagonal |
includes auto-links |
sort |
sort the list according to the values of a statistic. See below |
decreasing |
order in a decreasing way. |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
Possible measures in procedures are
Frequencies (f), Relative frequencies (x), Conditional frequencies (i), Coincidence degree (cc), Probable degree (cp),
Expected (e), Confidence interval (con)
Matching (m), Rogers & Tanimoto (t), Gower (g), Sneath (s), Anderberg (and),
Jaccard (j), Dice (d), antiDice (a), Ochiai (o), Kulczynski (k),
Hamann (ham), Yule (y), Pearson (p), odds ratio (od), Rusell (r),
Haberman (h), Z value of Haberman (z),
Hypergeometric p greater value (hyp).
Convert a matrix into an edge list (shape).
A data frame in which the two first columns are source and target. The rest of the columns are the different statistics explicited in funcs
parameter.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# From a random incidence matrix I(25X4) I<-matrix(rbinom(100,1,.5),nrow=25,ncol=4, dimnames=list(NULL,c("A","B","C","D"))) C<-coin(I) edgeList(C)
# From a random incidence matrix I(25X4) I<-matrix(rbinom(100,1,.5),nrow=25,ncol=4, dimnames=list(NULL,c("A","B","C","D"))) C<-coin(I) edgeList(C)
A sample size of 1,000 respondents from the European Social Survey, Round-8.
data("ess")
data("ess")
A data frame with 1000 cases (respondents) and 5 variables:
Gender
Gender (factor vector): Female, Male.
Age
Age (recoded factor vector): 15-29, 30-30, 40-49, 50-59, 60-69, 70 and +.
Social participation
Social participation (factor vector): No, Yes.
Political participation
Political participation (factor vector): No, Yes.
cweight
cweight (numeric vector): Cases weight.
ESS Round 8: European Social Survey Round 8 Data (2016). Data file edition 2.1. NSD - Norwegian Centre for Research Data, Norway - Data Archive and distributor of ESS data for ESS ERIC. doi:10.21338/NSD-ESS8-2016.
data("ess") head(ess,10)
data("ess") head(ess,10)
Data frame with the attributes of the events of dice.
data("events")
data("events")
A data frame with 10 observations on the following 4 variables:
name
: a factor vector with 10 levels
label
: a factor vector with 10 levels
frequency
: a numeric vector
type
: a factor vector with 2 levels
data(dice); coin.dice<-coin(dice); asNodes(coin.dice)
See dice
.
data(events) events
data(events) events
exhibit
produces an interactive image gallery (alternative display).
exhibit(nodes, name = NULL, label = NULL, subtitle = NULL, order = NULL, decreasing = FALSE, ntext = NULL, mainframeHeight = NULL, image = NULL, zoom = NULL, main = NULL, note = NULL, tutorial = FALSE, tableButton = FALSE, export = FALSE, colorScheme = 0, language = c("en", "es", "ca"), dir = NULL)
exhibit(nodes, name = NULL, label = NULL, subtitle = NULL, order = NULL, decreasing = FALSE, ntext = NULL, mainframeHeight = NULL, image = NULL, zoom = NULL, main = NULL, note = NULL, tutorial = FALSE, tableButton = FALSE, export = FALSE, colorScheme = 0, language = c("en", "es", "ca"), dir = NULL)
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. |
tutorial |
Should tutorial be displayed? |
tableButton |
A button will appear to show the data as a table. |
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. |
Object of class gallery_rd3
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field exhibit(finches, image="species")
data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field exhibit(finches, image="species")
Converts a coin
object to a links data frame with coincidences and expected values.
expectedList(data, names = NULL, min = 1, confidence=FALSE)
expectedList(data, names = NULL, min = 1, confidence=FALSE)
data |
is a |
names |
a character vector. |
min |
minimum value of the statistic to include the edge in the list. |
confidence |
add the confidence interval if TRUE. |
A links data frame with coincidences and expected values.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix expectedList(C) # edge data frame
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix expectedList(C) # edge data frame
Data frame with the characteristics of powerful families of Renaissance Italy.
data("families")
data("families")
A data frame with 16 families (rows) and 6 characteristics.
name
Family's name
f.Marriages
number of marriage links
f.Business
number of business links
wealth
wealth's index
priorates
number of priorates on control
seat
At least priorate
PADGETT, J. F. Y C. K. ANSELL (1993): "Robust Action and the Rise of the Medici, 1400-1434", in American Journal of Sociology, 98, 1259-1319. (http://www.jstor.org/stable/2781822)
data("families") head(families)
data("families") head(families)
Data frame with events as result.
data("finches")
data("finches")
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
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.
data(finches) head(finches,10)
data(finches) head(finches,10)
fromIgraph
produce an interactive network from an igraph object.
fromIgraph(G, ...)
fromIgraph(G, ...)
G |
an igraph object. |
... |
Any netCoin argument. |
This function returns a netCoin
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
g <- igraph::make_ring(10) fromIgraph(g)
g <- igraph::make_ring(10) fromIgraph(g)
Data frame with absence(0) presence(1) of finches in the Galagos Islands.
data("Galapagos")
data("Galapagos")
A data frame with 17 localizations (islands) and 13 variables (Genus and species of the finches):
Geospiza magnirostris
Geospiza fortis
Geospiza fuliginosa
Geospiza difficilis
Geospiza scandens
Geospiza conirostris
Camarhynchus psitticula
Camarhynchus pauper
Camarhynchus parvulus
Platyspiza crassirostris
Cactospiza pallida
Cactospiza heliobates
Certhidea olivacea
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.
data(Galapagos) head(Galapagos,10)
data(Galapagos) head(Galapagos,10)
gallery
produces an interactive image gallery.
gallery(nodes, name = NULL, label = NULL, color = NULL, border = NULL, ntext = NULL, info = NULL, infoFrame = c("right","left"), image = NULL, zoom = 1, itemsPerRow = NULL, main = NULL, note = NULL, showLegend = TRUE, frequencies = FALSE, labelTooltip = TRUE, cexTooltip = 1, help = NULL, helpOn = FALSE, tutorial = FALSE, description = NULL, descriptionWidth = NULL, roundedItems = FALSE, ntextctrl = FALSE, controls = 1:5, cex = 1, defaultColor = "#1f77b4", language = c("en", "es", "ca"), dir = NULL)
gallery(nodes, name = NULL, label = NULL, color = NULL, border = NULL, ntext = NULL, info = NULL, infoFrame = c("right","left"), image = NULL, zoom = 1, itemsPerRow = NULL, main = NULL, note = NULL, showLegend = TRUE, frequencies = FALSE, labelTooltip = TRUE, cexTooltip = 1, help = NULL, helpOn = FALSE, tutorial = FALSE, description = NULL, descriptionWidth = NULL, roundedItems = FALSE, ntextctrl = FALSE, controls = 1:5, cex = 1, defaultColor = "#1f77b4", language = c("en", "es", "ca"), dir = NULL)
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. |
color |
column name with image background color variable in the nodes data frame. |
border |
column name with image border width variable in the nodes data frame or a numeric vector. |
ntext |
column name with html text in the nodes data frame. |
info |
column name with information to display in a panel in the nodes data frame. |
infoFrame |
In which panel should the information be displayed? The left panel is only available if frequencies are not showing. |
image |
column name which indicates the image paths in the nodes data frame. |
zoom |
a number between 0.1 and 10 as initial displaying zoom. |
itemsPerRow |
number of items in each row. |
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. |
labelTooltip |
show label on mouseover. |
cexTooltip |
number indicating the amount by which plotting text should be scaled relative to the default in the label tooltip. |
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? |
tutorial |
Should tutorial be displayed? |
description |
a character string indicating a desription text for the graph. |
descriptionWidth |
a percentage indicating a width for the description panel (25 by default). |
roundedItems |
Display items with rounded borders. |
ntextctrl |
Previous tooltips will be closed unless you hold down the control key (FALSE by default). |
controls |
a numeric vector indicating which controls will be shown. 1 = topbar, 2 = xlsx exportation, 3 = table, 4 = netCoin logo, 5 = topbar buttons. NULL hide all controls, negative values deny each control and 0 deny all. |
cex |
number indicating the amount by which plotting text should be scaled relative to the default. |
defaultColor |
a character vector giving a valid html color for node representation. |
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. |
Object of class gallery_rd3
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field gallery(finches, image="species", main="Species in Galapagos Islands", note="Data source: Sanderson (2000)")
data("finches") finches$species <- system.file("extdata", finches$species, package="netCoin") # copy path to the species field gallery(finches, image="species", main="Species in Galapagos Islands", note="Data source: Sanderson (2000)")
Create an html panel for nodes from different items (for galleries).
get_panel_template(data, title=NULL, description=NULL, img=NULL, text=NULL, color="auto", cex=1, mode = 1)
get_panel_template(data, title=NULL, description=NULL, img=NULL, text=NULL, color="auto", cex=1, mode = 1)
data |
data frame which contains the data. |
title |
column name which contains the first title of the vignette. |
description |
column name which contains the main text of the vignette. |
img |
column name which contains the names of the image files. |
text |
column name which contains the main text of the vignette. |
color |
color of the panel (It also could be a column name which contains colors). |
cex |
number indicating the amount by which plotting text should be scaled relative to the default. |
mode |
There are two display modes. |
a character vector of html formatted panel.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Not run: data("sociologists") sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") sociologists$html <- get_panel_template(sociologists, title="name", description="birth_country",img="picture", text="school") plot(gallery(sociologists, info="html")) ## End(Not run)
## Not run: data("sociologists") sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") sociologists$html <- get_panel_template(sociologists, title="name", description="birth_country",img="picture", text="school") plot(gallery(sociologists, info="html")) ## End(Not run)
Create a drop-down vignette for nodes from different items (for galleries).
get_template( data, title = NULL, title2 = NULL, text = NULL, img = NULL, wiki = NULL, width = 300, color = "auto", cex = 1, roundedImg = FALSE, mode = 1 )
get_template( data, title = NULL, title2 = NULL, text = NULL, img = NULL, wiki = NULL, width = 300, color = "auto", cex = 1, roundedImg = FALSE, mode = 1 )
data |
data frame which contains the data. |
title |
column name which contains the first title of the vignette. |
title2 |
column name which contains the secondary title of the vignette. |
text |
column name which contains the main text of the vignette. |
img |
column name which contains the names of the image files. |
wiki |
column name which contains the wiki URL for the vignette. |
width |
length of the vignette's width. |
color |
color of the vignette's strip (It also could be a column name which contains colors). |
cex |
number indicating the amount by which plotting text should be scaled relative to the default. |
roundedImg |
Display images with rounded borders. |
mode |
2 display images next to the text. 1 by default. |
a character vector of html formatted vignettes.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Not run: data("sociologists") sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") sociologists$html <- get_template(sociologists, title="name", title2="birth_country", text="school",img="picture", mode=2) plot(gallery(sociologists, ntext="html")) ## End(Not run)
## Not run: data("sociologists") sociologists$picture <- system.file("extdata", sociologists$picture, package="netCoin") sociologists$html <- get_template(sociologists, title="name", title2="birth_country", text="school",img="picture", mode=2) plot(gallery(sociologists, ntext="html")) ## End(Not run)
Create a drop-down vignette for nodes from different items (for galleries).
get_template2(data, title=NULL, title2=NULL, text=NULL, wiki=NULL)
get_template2(data, title=NULL, title2=NULL, text=NULL, wiki=NULL)
data |
data frame which contains the data. |
title |
column name which contains the first title of the vignette. |
title2 |
column name which contains the secondary title of the vignette. |
text |
column name which contains the main text of the vignette. |
wiki |
column name which contains the wiki URL for the vignette. |
a character vector of html formatted vignettes.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Not run: data("sociologists") sociologists$html <- get_template2(sociologists, title="name", title2="birth_country", text="school") plot(exhibit(sociologists, ntext="html")) ## End(Not run)
## Not run: data("sociologists") sociologists$html <- get_template2(sociologists, title="name", title2="birth_country", text="school") plot(exhibit(sociologists, ntext="html")) ## End(Not run)
produces a netCoin object from a set of glm regressions.
glmCoin(formulas, data, weights=NULL, pmax=.05, twotail=FALSE, showArrows=TRUE, frequency = FALSE, percentage = TRUE, color="variable", lwidth="z.value", circle= NA, language=c("en","es","ca"), igraph=FALSE, ...)
glmCoin(formulas, data, weights=NULL, pmax=.05, twotail=FALSE, showArrows=TRUE, frequency = FALSE, percentage = TRUE, color="variable", lwidth="z.value", circle= NA, language=c("en","es","ca"), igraph=FALSE, ...)
formulas |
A set of formulas separated, folowed by the family and a return. For example: model <- "counts ~ outcome + treatment, poisson counts ~ outcome, poisson" |
data |
Data frame containing the variables in the model. |
weights |
Optional vector of weights to be used in the fitting process. |
pmax |
Selection of links with Pr(>|z|) less than p (one-tail by default). |
twotail |
Logical value indicating if twotail test must be appied. Defaul=FALSE. |
showArrows |
a logical value true if the directional arrows are to be shown. Default = FALSE. |
frequency |
a logical value true if frequencies are to be shown. Default=FALSE. |
percentage |
a logical value true if percentages are to be shown. Default=TRUE. |
color |
Nodes' attribute to be used for expressing color ("variable" by default). |
lwidth |
Nodes' attribute to be used for widht of arrows ("z.value" by default). |
circle |
Degre of rotation in case of fixed circled dependent variables. |
language |
Language of the graph controls. |
igraph |
Produces an igraph object instead of a netCoin object if TRUE. |
... |
Any netCoin argument. |
This function creates a netCoin object (or igraph) and, if stated, 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Dobson (1990) Page 93: Randomized Controlled Trial : counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) Dobson <- data.frame(counts=counts, outcome=outcome, treatment=treatment) model <- "counts ~ outcome + treatment, poisson" glmCoin(model,Dobson)
## Dobson (1990) Page 93: Randomized Controlled Trial : counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) Dobson <- data.frame(counts=counts, outcome=outcome, treatment=treatment) model <- "counts ~ outcome + treatment, poisson" glmCoin(model,Dobson)
Convert a data frame with two numbers (normally a beginning year and end year) into an incidences matrix whose rows are the intermediate numbers, and whose columns are the content of the names column.
incTime(data, name = "name", beginning = "birth", end= "death")
incTime(data, name = "name", beginning = "birth", end= "death")
data |
a data frame a name and two numbers. |
name |
Column with the names (default= "name"). |
beginning |
Column with the beginning number to include (default= "birth"). |
end |
Column with the end number to include (default= "death"). |
A data frame in which the two first columns are source and target. The rest of the columns are sim.=(1+threshold-real difference) and dist.=(difference between numbers)
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# From sociologists data data("sociologists") head(incTime(sociologists))[,1:5]
# From sociologists data data("sociologists") head(incTime(sociologists))[,1:5]
layoutCircle
produces a circle layout of any number of nodes.
layoutCircle(N,nodes=seq_len(nrow(N)),deg=0,name=NULL)
layoutCircle(N,nodes=seq_len(nrow(N)),deg=0,name=NULL)
N |
a data frame of nodes. |
nodes |
a vector specifing nodes. |
deg |
degrees to rotate. |
name |
name of column with node names. |
This function returns the input data frame of nodes with the resulting layout applied.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
A <- data.frame(name=letters) L <- layoutCircle(A,name="name") netCoin(A,layout=L)
A <- data.frame(name=letters) L <- layoutCircle(A,name="name") netCoin(A,layout=L)
layoutGrid
produces a grid layout of any number of nodes.
layoutGrid(N,string,name=NULL,byrow=FALSE)
layoutGrid(N,string,name=NULL,byrow=FALSE)
N |
a data frame of nodes. |
string |
a character vector specifing grouped nodes. |
name |
name of column with node names. |
byrow |
logical. If 'FALSE' (the default) the layout is filled by columns, otherwise the layout is filled by rows. |
This function returns the input data frame of nodes with the resulting layout applied.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
A <- data.frame(name=letters) L <- 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") netCoin(A,layout=L)
A <- data.frame(name=letters) L <- 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") netCoin(A,layout=L)
Data frame with the marriage and business links.
data("links")
data("links")
A data frame with 36 links (rows) amongst 16 Italian families in the Renaissance.
Albizzi
Acciaiuoli
Barbadori
Bischeri
Castellani
Guadagni
Lamberteschi
Medici
Pazzi
Peruzzi
Ridolfi
Salviati
Strozzi
Tornabuoni
Ginori
Pucci
link
Type of link: marriage or business
PADGETT, J. F. Y C. K. ANSELL (1993): "Robust Action and the Rise of the Medici, 1400-1434", in American Journal of Sociology, 98, 1259-1319. (http://www.jstor.org/stable/2781822)
data("links") head(links)
data("links") head(links)
logCoin
produces a network object from loglinear models parameters.
logCoin(data, variables=names(data), exogenous=NULL, noFirstCat= NULL, weight=NULL, order= 2, pairwise=FALSE, twotails = FALSE, pmax = 0.05, frequency = FALSE, percentage = FALSE, directed=FALSE, igraph=FALSE, ...)
logCoin(data, variables=names(data), exogenous=NULL, noFirstCat= NULL, weight=NULL, order= 2, pairwise=FALSE, twotails = FALSE, pmax = 0.05, frequency = FALSE, percentage = FALSE, directed=FALSE, igraph=FALSE, ...)
data |
a data frame. |
variables |
a vector of names of variables included in the previous data frame. |
exogenous |
a vector of names of variables whose relations amongst them are of no interest. None by default. |
noFirstCat |
a vector of names of dichotomous variables to appear without the category (no characteristic). |
weight |
a vector of weights. Optimal for dataframed tables. |
order |
maximum order parameters to be included in the loglinear model (default=2) |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
twotails |
Application of twotail tests to the parameters (default: FALSE, i.e., onetail) |
pmax |
maximum value of the statistic to include the edge in the list. By default is 0.05, but 0.5 is recommended if data has not been sampled. |
frequency |
a logical value true if frequencies are to be shown. Default=FALSE. |
percentage |
a logical value true if percentages are to be shown. Default=TRUE. |
directed |
includes arrows to the links (target would be the categories of first mention variables). |
igraph |
Produces an igraph object instead of a netCoin object if TRUE. |
... |
Any netCoin argument. |
This function creates a netCoin object (or igraph) and, if stated, 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A n=1,000 sample from the European Social Survey.(Round 8, 2016) data("ess") logCoin(ess, c("Social participation", "Political participation"), noFirstCat=c("Social participation", "Political participation"), exogenous=c("Age", "Gender"), weight = "cweight", order=3, pmax=.05,percentage = TRUE, frequency = TRUE ) # network object
# A n=1,000 sample from the European Social Survey.(Round 8, 2016) data("ess") logCoin(ess, c("Social participation", "Political participation"), noFirstCat=c("Social participation", "Political participation"), exogenous=c("Age", "Gender"), weight = "cweight", order=3, pmax=.05,percentage = TRUE, frequency = TRUE ) # network object
Display the lower part of a matrix with a specified number of decimals.
lower(matrix, decimals = 3)
lower(matrix, decimals = 3)
matrix |
a symmetric similarity/distance matrix |
decimals |
number of decimals to be displayed |
A data frame of characters.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# From a random incidence matrix I(25X4) I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) lower(sim(I, "Jaccard"), 2)
# From a random incidence matrix I(25X4) I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) lower(sim(I, "Jaccard"), 2)
Create a vignette from w_EntityInfo from wikiTools package (for galleries).
makeT(data, imageDir=NULL, imageDefault=NULL, language=c("en","es","ca"))
makeT(data, imageDir=NULL, imageDefault=NULL, language=c("en","es","ca"))
data |
A data-frame created with |
imageDir |
A directory where images will be found. The name must be the 'entity' column content follow by the image extension and the allowed formats are jpg, jpeg, gif, png and svg. |
imageDefault |
This image will be assigned if 'entity' image is not found in |
language |
a character string indicating the language of the graph (en=english (default); es=spanish; ca=catalan). |
a data frame wich includes a column of html formatted vignettes called 'info'.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Create a vignette from some specific information supplied (for galleries).
makeT2(entityLabel, image=NA, entityDescription=NA, byear=NA, bplace=NA, bcountry=NA, dyear=NA, dplace=NA, dcountry=NA, gender=NA, occupation=NA, language=c("en","es","ca"))
makeT2(entityLabel, image=NA, entityDescription=NA, byear=NA, bplace=NA, bcountry=NA, dyear=NA, dplace=NA, dcountry=NA, gender=NA, occupation=NA, language=c("en","es","ca"))
entityLabel |
A character string of names. |
image |
A character string of image paths. |
entityDescription |
A character string of descriptions. |
byear |
A character string of birth years. |
bplace |
A character string of birth places. |
bcountry |
A character string of birth countries. |
dyear |
A character string of death years. |
dplace |
A character string of death places. |
dcountry |
A character string of death countries. |
gender |
A character string of genders. |
occupation |
A character string of occupations. |
language |
a character string indicating the language of the graph (en=english (default); es=spanish; ca=catalan). |
a data frame wich includes a column of html formatted vignettes called 'info'.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Convert a data frame with one number (normally a year) into an edge list form with those whose numbers (years) have a difference lower or equal to a quantity.
mobileEdges(data, name = 1, number = 2, difference=0)
mobileEdges(data, name = 1, number = 2, difference=0)
data |
a data frame with a name and a number (year). |
name |
Column with the names (default= first column). |
number |
Column with the number (year) to compare (default= second column. |
difference |
Minimum difference between numbers of every two pair of names to create the edge or link (default=15). |
A data frame in which the two first columns are source and target. The rest of the columns are sim.=(1+threshold-real difference) and dist.=(difference between numbers)
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# From a random incidence matrix I(25X4) data("sociologists") mobileEdges(sociologists)
# From a random incidence matrix I(25X4) data("sociologists") mobileEdges(sociologists)
multigraphCreate
produce an interactive multi graph.
multigraphCreate(..., mode = c("default","parallel","frame"), mfrow = c(1,2), frame = 0, speed = 50, loop = FALSE, lineplots = NULL, dir = NULL, show = FALSE)
multigraphCreate(..., mode = c("default","parallel","frame"), mfrow = c(1,2), frame = 0, speed = 50, loop = FALSE, lineplots = NULL, dir = NULL, show = FALSE)
... |
rD3plot graphs (network_rd3, barplot_rd3, timeplot_rd3) objects or html "directories". |
mode |
a string specifying the displaying mode. The "default" displays graphs one by one, "parallel" splits screen and "frame" allows dinamic graphs in time. |
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. (Only applied in 'parallel' mode) |
frame |
number of frame to start a dynamic network. |
speed |
a percentage for frame speed in dynamic networks. |
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. |
show |
a logical value true if the graph is to be shown. Default = FALSE. |
This function returns a mGraph
object.
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C,c("frequency","expected","haberman")) # edge data frame bC<- barCoin(data,dichotomies="_all") # barCoin object cC<- barCoin(data,dichotomies="_all",expected=TRUE) # barCoin object nC<- netCoin(N,E) # netCoin object multi <- multigraphCreate("Bar graph" = bC, "Conditional bar graph" = cC, "Net graph"=nC) ## Not run: plot(multi) ## End(Not run)
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C,c("frequency","expected","haberman")) # edge data frame bC<- barCoin(data,dichotomies="_all") # barCoin object cC<- barCoin(data,dichotomies="_all",expected=TRUE) # barCoin object nC<- netCoin(N,E) # netCoin object multi <- multigraphCreate("Bar graph" = bC, "Conditional bar graph" = cC, "Net graph"=nC) ## Not run: plot(multi) ## End(Not run)
multiPages
produces a gallery page to explore multiple 'netCoin' graphs.
multiPages(x, title = NULL, columns = NULL, imageSize = NULL, description = NULL, note = NULL, cex = 1, dir = tempDir(), show = FALSE)
multiPages(x, title = NULL, columns = NULL, imageSize = NULL, description = NULL, note = NULL, cex = 1, dir = tempDir(), show = FALSE)
x |
is a |
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. |
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C,c("frequency","expected","haberman")) # edge data frame bC<- barCoin(data,dichotomies="_all") # barCoin object cC<- barCoin(data,dichotomies="_all",expected=TRUE) # barCoin object nC<- netCoin(N,E) # netCoin object multi <- multigraphCreate("Bar graph" = bC, "Conditional bar graph" = cC, "Net graph"=nC) ## Not run: multiPages(multi,"Some graphs",show=TRUE) ## End(Not run)
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C,c("frequency","expected","haberman")) # edge data frame bC<- barCoin(data,dichotomies="_all") # barCoin object cC<- barCoin(data,dichotomies="_all",expected=TRUE) # barCoin object nC<- netCoin(N,E) # netCoin object multi <- multigraphCreate("Bar graph" = bC, "Conditional bar graph" = cC, "Net graph"=nC) ## Not run: multiPages(multi,"Some graphs",show=TRUE) ## End(Not run)
netCoin
produces a netCoin object of coincidences. 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.
netCoin(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, centrality = NULL, nodeBipolar = FALSE, nodeFilter = NULL, degreeFilter = 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)
netCoin(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, centrality = NULL, nodeBipolar = FALSE, nodeFilter = NULL, degreeFilter = 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)
nodes |
a data frame with at least one vector of names. |
links |
a data frame with at least two vectors with source and target, including names of nodes. |
tree |
a data frame with two vectors: source and target, describing relationships between nodes. |
name |
name of the vector with names in the nodes data frame. By default, if language="en", name is "name". |
label |
name of the vector with labels in the nodes data frame. |
group |
name of the vector 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") |
centrality |
calculates the centrality measures of a network. See calCentr. |
labelSize |
name of the vector with label size in the nodes data frame. |
size |
name of the vector with size in the nodes data frame. |
color |
name of the vector with color variable in the nodes data frame. |
shape |
name of the vector with shape variable in the nodes data frame. |
border |
name of the column with border width in the nodes data frame. |
legend |
name of the vector with the variable to represent as a legend in the nodes data frame. |
ntext |
name of the vector with html text in the nodes data frame. |
info |
name of the vector with information to display in a panel in the nodes data frame. |
sort |
name of the vector 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 vector with intensity variable in the links data frame (only for heatmap). |
lwidth |
name of the vector with width variable in the links data frame. |
lweight |
name of the vector with weight variable in the links data frame. |
lcolor |
name of the vector with color variable in the links data frame. |
ltext |
name of the vector with labels in the links data frame. |
nodeFilter |
condition for filtering nodes. |
linkFilter |
condition for filtering links. |
degreeFilter |
numeric vector to filter the resulting network by degree. |
nodeBipolar |
a logical value that polarizes negative and positive node values in the graphical representation. Default = FALSE. |
linkBipolar |
a logical value that polarizes negative and positive link values in the graphical representation. Default = FALSE. |
defaultColor |
a character vector giving a valid html color. |
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 the frequencies can be shown in barplots. Default = FALSE. |
help |
help text of the graph. |
helpOn |
Should the help be shown at the beginning? |
background |
background color or image of the graph. |
layout |
a matrix with two columns or an algorithm to elaborate the coordinates: 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 size references to display layout, must be a numeric vector of length 4: x1, y1, x2, y2. |
cex |
number indicating the amount by which plotting text should be scaled relative to the default. Default = 1. |
roundedItems |
Display items 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. Default = TRUE. |
showAxes |
a logical value true if the axes are to be shown. Default = FALSE. |
axesLabels |
a character vector giving the axes names. |
language |
a character vector (es=spanish; en=english; ca=catalan). |
image |
name of the vector with image files in the nodes data frame. |
imageNames |
name of the vector with names for image files in the nodes data frame. |
dir |
a "character" string representing the directory where the web files will be saved. |
This function returns a netCoin
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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame netCoin(N, E) # netCoin object
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame netCoin(N, E) # netCoin object
netCorr
produces a network object of correlations. Its input has to be at least one set of quantitative variables.
netCorr(variables, weight=NULL, pairwise=FALSE, minimum=-Inf, maximum=Inf, sort=FALSE, decreasing=TRUE, frequency=FALSE, means=TRUE, method=c("pearson", "kendall", "spearman"), criteria="p", Bonferroni=FALSE, minL=0, maxL=Inf, sortL=NULL, decreasingL=TRUE, igraph=FALSE, ...)
netCorr(variables, weight=NULL, pairwise=FALSE, minimum=-Inf, maximum=Inf, sort=FALSE, decreasing=TRUE, frequency=FALSE, means=TRUE, method=c("pearson", "kendall", "spearman"), criteria="p", Bonferroni=FALSE, minL=0, maxL=Inf, sortL=NULL, decreasingL=TRUE, igraph=FALSE, ...)
variables |
a data frame with at least two quantitative variables. |
weight |
a vector of weights. Optimal for data.framed tables |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
minimum |
minimum frequency to be considered |
maximum |
maximum frequency to be considered |
sort |
sort the correlation matrix according to the frequency of the events |
decreasing |
decreasing or increasing sort of the matrix |
frequency |
a logical value true if frequencies are to be shown. Default=FALSE. |
means |
a logical value true if means are to be shown. Default=TRUE. |
method |
a vector of statistics of similarity. Pearson correlation by default. spearman and kendall are also possible |
criteria |
statistic to be use for selection criteria. |
Bonferroni |
Bonferroni criterium of the signification test. |
minL |
minimum value of the statistic to include the edge in the list. |
maxL |
maximum value of the statistic to include the edge in the list. |
sortL |
sort the list according to the values of a statistic. See below |
decreasingL |
order in a decreasing way. |
igraph |
Produces an igraph object instead of a netCoin object if TRUE |
... |
Any netCoin argument. |
The function creates a netCoin object and eventually 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) data(iris) netCorr(iris[,1:4],ltext="value", main="Correlations between measurements of Iris Species", note="Anderson, Edgar (1935) y Fisher, R. A. (1936)") # network object
# A character column (with separator) data(iris) netCorr(iris[,1:4],ltext="value", main="Correlations between measurements of Iris Species", note="Anderson, Edgar (1935) y Fisher, R. A. (1936)") # network object
netExhibit
produces an interactive image gallery (alternative display).
netExhibit(tree, initialType = NULL, tableformat = FALSE, ...)
netExhibit(tree, initialType = NULL, tableformat = FALSE, ...)
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 exhibit argument. |
Object of class treeGallery_rd3
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
# 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 <- netExhibit(tree, initialType="film", tableformat=TRUE) ## 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 <- netExhibit(tree, initialType="film", tableformat=TRUE) ## Not run: plot(gallery) ## End(Not run)
netGallery
produces an interactive image gallery.
netGallery(tree, deep = FALSE, initialType = NULL, tableformat = FALSE, ...)
netGallery(tree, deep = FALSE, initialType = NULL, tableformat = FALSE, ...)
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 argument. |
Object of class netGallery
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca.
# 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 <- netGallery(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 <- netGallery(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<-netGallery(tree,deep=TRUE,color="type") ## Not run: plot(gallery) ## End(Not run)
# 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 <- netGallery(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 <- netGallery(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<-netGallery(tree,deep=TRUE,color="type") ## Not run: plot(gallery) ## End(Not run)
pathCoin
produces a netCoin object from a lavaan object, i.e., parameters of structural equation model.
pathCoin(model, estimates=c("b","se","z","pvalue","beta"), fitMeasures=c("chisq", "cfi", "rmsea"), ...)
pathCoin(model, estimates=c("b","se","z","pvalue","beta"), fitMeasures=c("chisq", "cfi", "rmsea"), ...)
model |
a lavaan object. |
estimates |
A vector with at least one element amongst "b", "se", "z", "pvalue", "beta". |
fitMeasures |
Default values: "chisq", "df", "pvalue", "cfi", "rmsea" |
... |
Any netCoin argument. |
The function creates a netCoin object and eventually 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# Classic Wheaton et al. model library(lavaan) lower <- ' 11.834 6.947 9.364 6.819 5.091 12.532 4.783 5.028 7.495 9.986 -3.839 -3.889 -3.841 -3.625 9.610 -21.899 -18.831 -21.748 -18.775 35.522 450.288 ' wheaton.cov <- getCov(lower, names = c("anomia67", "powerless67","anomia71", "powerless71", "education", "sei")) wheaton.model <- ' # latent variables ses =~ education + sei alien67 =~ anomia67 + powerless67 alien71 =~ anomia71 + powerless71 # regressions alien71 ~ alien67 + ses alien67 ~ ses # correlated residuals anomia67 ~~ anomia71 powerless67 ~~ powerless71 ' fit <- sem(wheaton.model, sample.cov = wheaton.cov, sample.nobs = 932) pathCoin(fit)
# Classic Wheaton et al. model library(lavaan) lower <- ' 11.834 6.947 9.364 6.819 5.091 12.532 4.783 5.028 7.495 9.986 -3.839 -3.889 -3.841 -3.625 9.610 -21.899 -18.831 -21.748 -18.775 35.522 450.288 ' wheaton.cov <- getCov(lower, names = c("anomia67", "powerless67","anomia71", "powerless71", "education", "sei")) wheaton.model <- ' # latent variables ses =~ education + sei alien67 =~ anomia67 + powerless67 alien71 =~ anomia71 + powerless71 # regressions alien71 ~ alien67 + ses alien67 ~ ses # correlated residuals anomia67 ~~ anomia71 powerless67 ~~ powerless71 ' fit <- sem(wheaton.model, sample.cov = wheaton.cov, sample.nobs = 932) pathCoin(fit)
It generates pie charts from a coin object.
pieCoin(x, colors = c("#000000","#8dc7e6", "#ffffff","#005587"), nodes = NULL, links = NULL, name = NULL, lcolor = NULL, expected = TRUE, abline = NULL, main = NULL, note = NULL, showLegend = TRUE, help = NULL, helpOn = FALSE, cex = 1, language = c("en", "es", "ca"), dir = NULL)
pieCoin(x, colors = c("#000000","#8dc7e6", "#ffffff","#005587"), nodes = NULL, links = NULL, name = NULL, lcolor = NULL, expected = TRUE, abline = NULL, main = NULL, note = NULL, showLegend = TRUE, help = NULL, helpOn = FALSE, cex = 1, language = c("en", "es", "ca"), dir = NULL)
x |
a |
nodes |
a data frame with information for each event. |
links |
a data frame with information for each pie. |
name |
name of the column with names in the nodes data frame. |
colors |
a vector of colors to be used when filling the slices. |
lcolor |
name of the column with color variable in the links data frame. |
expected |
Should expected coincidences be displayed? |
abline |
adds one or more straight lines between pies. |
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. |
a pieCoin
object.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Hair by Eye by Sex table from M. Friendly (2000) data(HairEyeColor) H<-as.data.frame(HairEyeColor) W<-H$Freq I<-dichotomize(H,c("Hair","Eye","Sex"),add=FALSE) C <- coin(I,w=W) pie <- pieCoin(C) ## Not run: plot(pie) ## End(Not run)
## Hair by Eye by Sex table from M. Friendly (2000) data(HairEyeColor) H<-as.data.frame(HairEyeColor) W<-H$Freq I<-dichotomize(H,c("Hair","Eye","Sex"),add=FALSE) C <- coin(I,w=W) pie <- pieCoin(C) ## Not run: plot(pie) ## End(Not run)
This is like 'prop.table' for 'coin' objects.
propCoin(x, margin= 0, decimals=1)
propCoin(x, margin= 0, decimals=1)
x |
'coin' object. |
margin |
index, or vector of indices to generate margin for. |
decimals |
integer indicating the number of decimal places to be used. |
Table like 'x' expressed relative to 'margin'.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Random incidence matrix: 25 scenarios, 4 events. I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) C <- coin(I, sort = TRUE) propCoin(C, 1)
## Random incidence matrix: 25 scenarios, 4 events. I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4, dimnames = list(NULL, c("A", "B", "C", "D"))) C <- coin(I, sort = TRUE) propCoin(C, 1)
Create an html list of links.
renderLinks(data, columns, labels = NULL, target = "_blank", sites = NULL)
renderLinks(data, columns, labels = NULL, target = "_blank", sites = NULL)
data |
data frame which contains the data. |
columns |
column name which contains the urls. |
labels |
column name which contains the text to display. |
target |
The target attribute specifies where to open the linked document: '_blank' opens the linked document in a new window or tab; '_self' opens the linked document in the same frame as it was clicked; framename opens the linked document in the named iframe. |
sites |
A data frame of 3 columns (url, name, icon) with the sites that the function will recognize. |
a character vector of html formatted links.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
links <- data.frame(name = c( "Camarhynchus psitticula", "Camarhynchus pauper", "Camarhynchus parvulus" ), wikipedia=c( "https://en.wikipedia.org/wiki/Large_tree_finch", "https://en.wikipedia.org/wiki/Medium_tree_finch", "https://en.wikipedia.org/wiki/Small_tree_finch" ),wikidata=c( "https://www.wikidata.org/wiki/Q578835", "https://www.wikidata.org/wiki/Q1125857", "https://www.wikidata.org/wiki/Q1086136" )) html <- renderLinks(links,c("wikipedia","wikidata"))
links <- data.frame(name = c( "Camarhynchus psitticula", "Camarhynchus pauper", "Camarhynchus parvulus" ), wikipedia=c( "https://en.wikipedia.org/wiki/Large_tree_finch", "https://en.wikipedia.org/wiki/Medium_tree_finch", "https://en.wikipedia.org/wiki/Small_tree_finch" ),wikidata=c( "https://www.wikidata.org/wiki/Q578835", "https://www.wikidata.org/wiki/Q1125857", "https://www.wikidata.org/wiki/Q1086136" )) html <- renderLinks(links,c("wikipedia","wikidata"))
saveGhml
produces a .graphml file from a netCoin object.
saveGhml(net, file="netCoin.graphml")
saveGhml(net, file="netCoin.graphml")
net |
A netCoin object. |
file |
The name of the file. If not extension, .gexf is used as default. |
The function creates a file with vertices and arcs or edges of a netCoin object.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Not run: # A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", add=FALSE, sep = "; ") graph <- allNet(data, maxL=.5) # graph from an incidence matrix saveGhml(graph,"graph") # save graph.net file ## End(Not run)
## Not run: # A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", add=FALSE, sep = "; ") graph <- allNet(data, maxL=.5) # graph from an incidence matrix saveGhml(graph,"graph") # save graph.net file ## End(Not run)
savePajek
produces a .net (.paj) file from a netCoin object.
savePajek(net, file="file.net", arcs=NULL, edges=NULL, partitions=NULL, vectors=NULL)
savePajek(net, file="file.net", arcs=NULL, edges=NULL, partitions=NULL, vectors=NULL)
net |
a netCoin object. |
file |
The name of the file without extension. It will be .net or .paj acoording to data. The default is file.net or file.paj |
arcs |
Names of netCoin$links to be included and considered as arcs in the Pajek file.. |
edges |
Names of netCoin$links to be included and considered as edges in the Pajek file.. |
partitions |
Names of netCoin$nodes to be included and considered as partitions in the Pajek file. |
vectors |
Names of netCoin$nodes to be included and considered as vectors in the Pajek file. |
The function creates a file with vertices and arcs or edges of a netCoin objetct. Vectors and partitions can be also included. .
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Not run: # A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", add=FALSE, sep = "; ") graph <- allNet(data) # graph from an incidence matrix savePajek(graph,"graph",edges="Haberman") # save graph.net file ## End(Not run)
## Not run: # A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", add=FALSE, sep = "; ") graph <- allNet(data) # graph from an incidence matrix savePajek(graph,"graph",edges="Haberman") # save graph.net file ## End(Not run)
Load a netCoin plot to display in shiny.
shinyCoin(x)
shinyCoin(x)
x |
is a |
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
## Not run: # A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep="; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame net <- netCoin(N, E) # netCoin object shinyCoin(net) ## End(Not run)
## Not run: # A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep="; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) # edge data frame net <- netCoin(N, E) # netCoin object shinyCoin(net) ## End(Not run)
It calculates a similarity/distance matrix from either an incidence data frame/matrix or a coin object.
sim(input, procedures="Jaccard", level=.95, distance=FALSE, minimum=1, maximum=Inf, sort=FALSE, decreasing=FALSE, weight = NULL, pairwise = FALSE)
sim(input, procedures="Jaccard", level=.95, distance=FALSE, minimum=1, maximum=Inf, sort=FALSE, decreasing=FALSE, weight = NULL, pairwise = FALSE)
input |
a binary data frame or a coin object, let's say an R list composed by a number of scenarios ( |
procedures |
a vector of statistics of similarity. See details below. |
level |
confidence level |
distance |
convert the similarity matrix into a distance matrix |
minimum |
minimum frequency to obtain a similarity/distance measure. |
maximum |
maxium frequency to obtain a similarity/distance measure. |
sort |
sort the list according to the values of a statistic. See details below |
decreasing |
order in a decreasing way. |
weight |
a vector of weights. Optimal for data.framed tables |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
Possible measures in procedures are
Frequencies (f), Relative frequencies (x), Conditional frequencies (i), Coincidence degree (cc), Probable degree (cp),
Expected (e), Confidence interval (con)
Matching (m), Rogers & Tanimoto (t), Gower (g), Sneath (s), Anderberg (and),
Jaccard (j), Dice (d), antiDice (a), Ochiai (o), Kulczynski (k),
Hamann (ham), Yule (y), Pearson (p), odds ratio (od), Rusell (r),
Haberman (h), Z value of Haberman (z).
Hypergeometric p greater value (hyp).
A similarity/distance matrix.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# From a random incidence matrix I(25X4) I<-matrix(rbinom(100,1,.5),nrow=25,ncol=4, dimnames=list(NULL,c("A","B","C","D"))) sim(I) #Same results C<-coin(I) sim(C)
# From a random incidence matrix I(25X4) I<-matrix(rbinom(100,1,.5),nrow=25,ncol=4, dimnames=list(NULL,c("A","B","C","D"))) sim(I) #Same results C<-coin(I) sim(C)
Data frame with names, birth and death year data, birth country and movement.
data("sociologists")
data("sociologists")
A data frame with life's period of 16 sociologists and the following 11 variables to study time coincidences:
name
: name and last name of the sociologist.
birth
: birth year.
death
: death year.
birth_place
: birth place.
birth_country
: birth country.
death_place
: death place.
death_country
: death country.
label
: combination of name, birth and death dates.
generation
: generation (every 25 years) of the sociologists.
school
: school of thought.
picture
: name of the file where their picture is.
Own elaboration from manuals of sociology.
See events.
data(sociologists) head(sociologists, 10) tail(sociologists, 10)
data(sociologists) head(sociologists, 10) tail(sociologists, 10)
surCoin
produces a network object of coincidences from a data frame converting variables into dichotomies.
surCoin(data,variables=names(data), commonlabel=NULL, dichotomies=NULL, valueDicho=1, metric=NULL, exogenous=NULL, weight=NULL, subsample=FALSE, pairwise=FALSE, minimum=1, maximum=nrow(data), sort=FALSE, decreasing=TRUE, frequency=FALSE, percentages=TRUE, procedures="Haberman", criteria="Z", Bonferroni=FALSE, support=-Inf, minL=-Inf, maxL=Inf, directed=FALSE, diagonal=FALSE, sortL=NULL, decreasingL=TRUE, igraph=FALSE, coin=FALSE, dir=NULL, ...)
surCoin(data,variables=names(data), commonlabel=NULL, dichotomies=NULL, valueDicho=1, metric=NULL, exogenous=NULL, weight=NULL, subsample=FALSE, pairwise=FALSE, minimum=1, maximum=nrow(data), sort=FALSE, decreasing=TRUE, frequency=FALSE, percentages=TRUE, procedures="Haberman", criteria="Z", Bonferroni=FALSE, support=-Inf, minL=-Inf, maxL=Inf, directed=FALSE, diagonal=FALSE, sortL=NULL, decreasingL=TRUE, igraph=FALSE, coin=FALSE, dir=NULL, ...)
data |
a data frame. |
variables |
a vector of variables included in the previous data frame. |
commonlabel |
a vector of variables whose names are to be included in nodes labels. |
dichotomies |
a vector of dichotomous variables to appear as just one category. |
valueDicho |
value or values to be selected for dichotomous variables. Default is 1. |
metric |
a vector of metrics. |
exogenous |
a vector of variables whose relations amongst them are of no interest. None by default. |
weight |
a vector of weights. Optimal for data.framed tables. |
subsample |
retrict the analysis to scenarios with at least one event. |
pairwise |
Pairwise mode of handling missing values if TRUE. Listwise by default. |
minimum |
minimum frequency to be considered. |
maximum |
maximum frequency to be considered. |
sort |
sort the coincidence matrix according to frequency of events. |
decreasing |
decreasing or increasing sort of the matrix. |
frequency |
a logical value true if frequencies are to be shown. Default=FALSE. |
percentages |
a logical value true if percentages are to be shown. Default=TRUE. |
procedures |
a vector of statistics of similarity. See below. |
criteria |
statistic to be use for selection criteria. |
Bonferroni |
Bonferroni criterium of the signification test. |
support |
minimum value of the frequency of the coincidence to be edged. |
minL |
minimum value of the statistic to include the edge in the list. |
maxL |
maximum value of the statistic to include the edge in the list. By default is +Inf, except if criteria="Z" or criteria="hyp", in which case it is .5. It is recommnended to change it to .05 if data has been sampled. |
directed |
includes same edges only once. |
diagonal |
includes auto-links. |
sortL |
sort the list according to the values of a statistic. See below. |
decreasingL |
order in a decreasing way. |
igraph |
Produces an igraph object instead of a netCoin object if TRUE. |
coin |
Only return the coincidences matrix if TRUE. |
dir |
a "character" string representing the directory where the web files will be saved. |
... |
Any netCoin argument. |
Possible measures in procedures are
Frequencies (f), Relative frequencies (x), Conditional frequencies (i), Coincidence degree (cc), Probable degree (cp),
Expected (e), Confidence interval (con)
Matching (m), Rogers & Tanimoto (t), Gower (g), Sneath (s), Anderberg (and),
Jaccard (j), Dice (d), antiDice (a), Ochiai (o), Kulczynski (k),
Hamann (ham), Yule (y), Pearson (p), odds ratio (od), Rusell (r),
Haberman (h), Z value of Haberman (z),
Hypergeometric p greater value (hyp).
Convert a matrix into an edge list (shape).
This function creates a netCoin object (or igraph) and, if stated, 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A data frame with two variables Gender and Opinion frame <- data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) surCoin(frame,commonlabel="") # network object # A data frame with two variables (Gender and Hand) and nodes input <- data.frame( Gender = c("Women", "Men", "Men", "Women", "Women","Men", "Men", "Men", "Women", "Women", "Men", "Women"), Hand = c("Right", "Left","Right", "Right", "Right", "Right", "Left", "Right", "Right", "Left","Right", "Right")) nodes <- data.frame( name = c("Gender:Men","Gender:Women", "Hand:Left", "Hand:Right"), label = c("Women(50\u25)","Men(50\u25)", "Left hand(25\u25)", "Right hand(75\u25)")) G <- surCoin(input, nodes=nodes, proc=c("h","i"), label="label", ltext="i", showArrows=TRUE, maxL=.99)
# A data frame with two variables Gender and Opinion frame <- data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) surCoin(frame,commonlabel="") # network object # A data frame with two variables (Gender and Hand) and nodes input <- data.frame( Gender = c("Women", "Men", "Men", "Women", "Women","Men", "Men", "Men", "Women", "Women", "Men", "Women"), Hand = c("Right", "Left","Right", "Right", "Right", "Right", "Left", "Right", "Right", "Left","Right", "Right")) nodes <- data.frame( name = c("Gender:Men","Gender:Women", "Hand:Left", "Hand:Right"), label = c("Women(50\u25)","Men(50\u25)", "Left hand(25\u25)", "Right hand(75\u25)")) G <- surCoin(input, nodes=nodes, proc=c("h","i"), label="label", ltext="i", showArrows=TRUE, maxL=.99)
surScat
produces a network object of coincidences from a data frame converting variables into dichotomies.
surScat(data, variables=names(data), active=variables, type=c("mca", "pca"), nclusters=2, maxN=2000, ...)
surScat(data, variables=names(data), active=variables, type=c("mca", "pca"), nclusters=2, maxN=2000, ...)
data |
a data frame. |
variables |
a vector of variables included in the previous data frame. |
active |
a vector of variables actived in the previous data frame. |
type |
Factorial type: mca for qualitative active variables, pca for quantitative active variables. |
nclusters |
number of clusters. |
maxN |
Maximum number or rows. |
... |
Any netCoin argument. |
Possible measures in procedures are
Frequencies (f), Relative frequencies (x), Conditional frequencies (i), Coincidence degree (cc), Probable degree (cp),
Expected (e), Confidence interval (con)
Matching (m), Rogers & Tanimoto (t), Gower (g), Sneath (s), Anderberg (and),
Jaccard (j), Dice (d), antiDice (a), Ochiai (o), Kulczynski (k),
Hamann (ham), Yule (y), Pearson (p), odds ratio (od), Rusell (r),
Haberman (h), Z value of Haberman (z),
Hypergeometric p greater value (hyp).
Convert a matrix into an edge list (shape).
This function creates a netCoin object (or igraph) and, if stated, 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.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Escobar, M. and Martinez-Uribe, L. (2020)
Network Coincidence Analysis: The netCoin
R
Package.
Journal of Statistical Software, 93, 1-32.
doi:10.18637/jss.v093.i11.
# A data frame with two variables Gender and Opinion frame<-data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) surScat(frame) # network object
# A data frame with two variables Gender and Opinion frame<-data.frame(Gender=c(rep("Man",3),rep("Woman",3)), Opinion=c("Yes","Yes","No","No","No","Yes")) surScat(frame) # network object
timeCoin
produces a timeCoin object.
timeCoin(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)
timeCoin(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)
periods |
a data frame with at least three vectors of name, start and end of the periods. |
name |
name of the vector with names in the periods data frame. |
start |
name of the vector with starts in the periods data frame. |
end |
name of the vector with ends in the periods data frame. |
group |
name of the vector with groups in the periods data frame. |
text |
name of the vector with html text in the periods data frame. |
main |
upper title of the graph. |
note |
lower title of the graph. |
info |
name of the vector with information to display in a panel in the periods data frame. |
events |
a data frame of events included into the periods with three columns: event name, periodParent and eventTime |
eventNames |
name of the vector with names in the events data frame. |
eventPeriod |
name of the vector with period names in the events data frame. |
eventTime |
name of the vector with time points in the events data frame. |
eventColor |
name of the vector with color criteria in the events data frame. |
eventShape |
name of the vector with shape criteria in the events data frame. |
cex |
number indicating the amount by which plotting text should be scaled relative to the default. Default = 1. |
language |
a character vector (es=spanish; en=english; ca=catalan). |
dir |
a "character" string representing the directory where the web files will be saved. |
Object of class timeCoin
.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# Database of the classical sociologists. # Only periods data(sociologists) timeCoin(sociologists, "name", "birth", "death", "school") # Periods and events data(works) timeCoin(sociologists, "name", "birth", "death", "school", events=works, eventNames="label", eventPeriod="author", eventTime="date")
# Database of the classical sociologists. # Only periods data(sociologists) timeCoin(sociologists, "name", "birth", "death", "school") # Periods and events data(works) timeCoin(sociologists, "name", "birth", "death", "school", events=works, eventNames="label", eventPeriod="author", eventTime="date")
igraph
object from a netCoin
object.
toIgraph(net)
toIgraph(net)
net |
is a |
An igraph
object.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) net <- netCoin(N, E) toIgraph(net) # conversion into a igraph object
# A character column (with separator) frame <- data.frame(A = c("Man; Women", "Women; Women", "Man; Man", "Undet.; Women; Man")) data <- dichotomize(frame, "A", sep = "; ")[2:4] C <- coin(data) # coincidence matrix N <- asNodes(C) # node data frame E <- edgeList(C) net <- netCoin(N, E) toIgraph(net) # conversion into a igraph object
Data frame with classical sociological works writen by authors in the sociologists data frame.
data("sociologists")
data("sociologists")
A data frame with 54 observations (events) and the following 4 variables to study coincidences in time:
name
: name and last name of the author of the work.
label
: abbreviation of the complete name.
works
: work's name.
date
: year of its first publication.
Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/
Own elaboration from manuals of sociology.
See events.
data(works) head(works, 10) tail(works, 10)
data(works) head(works, 10) tail(works, 10)