cobCoin: CobWeb graph (Upton).

View source: R/netcoin.R

cobCoinR Documentation

CobWeb graph (Upton).

Description

cobCoin produces a netCoin object to graph a CoWeb graphic (Upton 2000).

Usage

cobCoin(data, variables=names(data), degree=0, significance=.05, ...)

Arguments

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

...

Any surCoin or netCoin argument.

Value

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.

Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/

References

Upton, Graham J.G. (2000) Cobweb diagrams for multiway contingency tables. The Statistician, 49(1), 79-85.

Examples

# 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)

netCoin documentation built on March 31, 2023, 7:34 p.m.