Description Usage Arguments Details Value Warning Author(s) References See Also Examples
View source: R/buildFamilyNetwork_Community.R
This function produces a community-level network following the rules of name inheritance used in the Philippines. These rules were employed by Cruz, Labonne, and Querubin (2016) to construct family-level networks (where family names are the nodes; see the function buildFamilyNetwork_Fam to replicate their work). The nodes in the networks produced by this function are communities and the edges are weighted according to the total number of relatives individuals in either community have in the other.
1 | buildFamilyNetwork_Community(data, lastName, middleName, ID, byArea, withinArea, graph=TRUE)
|
data |
A data frame with individuals on the rows and attributes on the columns. One row per individual. |
lastName |
Character string corresponding to the column in data of last names. |
middleName |
Character string corresponding to the name of the vector of middle names in data. |
ID |
Character string corresponding to the name of a unique identifier for individuals in data. Numeric identifiers work best. Default is NULL. If NULL, unique IDs generated. |
byArea |
Character string corresponding to the name of a vector in data that distinguishes an area that will constitute the nodes in the network. Vector is coerced to factor. Default is NULL. See details for more information. |
withinArea |
Character string corresponding to the name of a vector in data that distinguishes the area within which the nodes may be connected. Vector is coerced to factor. Default is NULL. If you wish to construct the network within the entire range of byAreas in data, point withinArea to a column that is constant across all these byAreas. See details for more information. |
graph |
Logical. Should an igraph object be produced. If false, a edge list is returned. Default is TRUE. |
This function constructs family networks, with communities serving as nodes in the network. The function uses the naming convention first exploited by Cruz, Labonne, and Querubin (2016) to identify relatives, but does so looking at inter-community relatives. See their paper for details on the inheritance rules that make this possible.
The byArea is the community that serves as a node in the network produced by this function. Ties between byAreas are only constructed between byAreas that share a withinArea.
Either an igraph object with weights or an edge list with three columns. The first two contain community identifiers (corresponding with unique values in byArea). The third column has the count of individuals in either community who have a relative in the other.
The function works best when the input values are character strings. The function gets especially confused when byArea and withinArea are factors where every level is not represented in the data. If you wish to use a factor in this case, use droplevels on the vector first.
Michael Davidson mwdavidson@ucsd.edu
Cruz, C., Labonne, J. & Querubin, P. 2016. Politician Family Networks and Electoral Outcomes.
Davidson, M., Hicken, H., & Ravanilla, Nico. 2016. Family Networks and Voting Behavior: Evidence from the Philippines.
buildFamilyNetwork_Ind
,
buildFamilyNetwork_Family
1 2 3 4 5 6 7 8 | # Load sample data
data(CARASI)
# Igraph Object
buildFamilyNetwork_Community(data=CARASI, lastName="lastName", middleName="middleName", ID="ID", byArea="BARANGAY", withinArea="MUNICIPALITY", graph=TRUE)
# Edgelist
buildFamilyNetwork_Community(data=CARASI, lastName="lastName", middleName="middleName", ID="ID", byArea="BARANGAY", withinArea="MUNICIPALITY", graph=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.