Learn R Programming

netcmc (version 1.0.2)

getMembershipMatrix: A function that generates a data.frame that is the membership matrix of the network.

Description

A function that generates a data.frame that is the membership matrix of the network given individual IDs and the alters that they have nominated.

Usage

getMembershipMatrix(individualID, alters)

Value

membershipMatrix

The resultant data.frame.

Arguments

individualID

A data.frame which stores the IDs of the individuals that nominate alters.

alters

A data.frame which stores the alters of a given individual.

Author

George Gerogiannis

Examples

Run this code
  
  individualID = data.frame(c(1, 2, 3))
  alters = data.frame(c(5, 3, 2), c(5, 6, 1))
  getMembershipMatrix(individualID, alters)
  
  individualID = data.frame(c(1, 2, 3))
  alters = data.frame(c(NA, 3, 2), c(NA, NA, 1))
  getMembershipMatrix(individualID, alters)
  
  individualID = data.frame(c(1, 2, 3))
  alters = data.frame(c(NA, 3, NA), c(NA, NA, 1))
  getMembershipMatrix(individualID, alters)
  
  individualID = data.frame(c(1, 2, 3))
  alters = data.frame(c(NA, 3, NA), c(6, NA, 1))
  getMembershipMatrix(individualID, alters)
  

Run the code above in your browser using DataLab