Learn R Programming

Dominance (version 1.0.0)

Sociogram: Social Network Graphs

Description

computes social network graphs with igraph

Usage

Sociogram(data_sheet, bits, ...)

Arguments

data_sheet
either a data.frame f.e imported from a data sheet containing "Name","item.number" "action.from.","action.to","kind.of.action"
bits
as sting where each enabled action is set to 1 and each disabled action is set to 0
...
Postscript: FALSE (default) or path to PS output file soziogram_layout: layout.auto,layout.random,layout.circle,layout.sphere,layout.fruchterman.reingold,layout.kamada.kawai,layout.spring,layout.reingold.tilford,layout.fruchterman.reingold.grid,layou

Value

  • sociogramthe igraph object
  • counts_circlesthe count of cirles
  • count_interactionsthe count of interactions
  • line_sizethe used linesize
  • counts_circlesvector of min and max line size

Examples

Run this code
## you can eihter use:
data_sheet=data.frame   ("action.from"=c(1,4,2,3,4,3,4,3,4,3,4,3,4,3,4),
                   "action.to"=c(4,1,1,4,3,4,3,4,3,4,3,4,3,4,3),
                   "kind.of.action"= c(4,1,1,4,3,4,3,4,3,4,3,4,3,4,3),stringsAsFactors=FALSE)
items= data.frame ("Name"=c("item1","item2","item3","item4","item5","item6") ,
                   "item.number"=c(1:6),stringsAsFactors=FALSE)
actions=data.frame("name.of.action"= c("leading","following","approach","bite","threat to bite",
                   "kick","threat to kick", "chase","retreat"),
                   "action.number"=c(1:9),
                   "classification"=c(1,2,1,1,1,1,1,1,2) ,
                   "weighting"=c(1,-1,1,1,1,1,1,1,-1),stringsAsFactors=FALSE)
## all  encounters  without leading and following
bytes= "001111111"  
Sociogram(data_sheet,items=items,actions=actions,bytes)
## mor you can use a complete f.e Excel sheet
## you can save this data as basic excel sheet to work with
data(data_Network_1)
## set 1 for action you want to show
bytes= "00111111111000000000"    
Sociogram(data_Network_1,bytes)

Run the code above in your browser using DataLab