get_network_data: Get state networks data

View source: R/get_network_data.R

get_network_dataR Documentation

Get state networks data

Description

network_data returns a dataframe of the state networks data compiled by the Correlates of State Policy Project. The dataframe is in an edge list format, with each row a state dyad combination. The merge argument allows the direct merging of a dataframe generated by the get_cspp_data function.

Usage

get_network_data(category = NULL, merge_data = NULL)

Arguments

category

A category within the networks data. Default is NULL. If left blank, returns the full state networks data. Category options are "Distance Travel Migration", "Economic", "Political", "Policy", "Demographic".

merge_data

Default is NULL. Takes a dataframe object in the format generated by get_cspp_data. The function merges this dataframe into the network data by state. If the merge dataframe has multiple observations per state, this function averages over all values per state as long as the variables are numeric. If the dataframe passed has multiple values per state and some are not numeric, only numeric variables are merged.

Details

The network dataframe that results is directed, with variables directed towards the state in the State1 column. For instance, the IncomingFlights variable is the number of flights from State2 with a destination in State1.

Value

A dataframe formatted as an edge list.

See Also

For more information on the construction of the network data as well as a full codebook see http://ippsr.msu.edu/public-policy/state-networks.

Examples


# Load full network data:
network.df <- get_network_data()

# Network data for subset of categories:
network.df <- get_network_data(category = c("Economic", "Political"))

# Merge in data from get_cspp_data()
network.df <- get_network_data(category = "Distance Travel Migration",
                               merge_data  = get_cspp_data(vars = c("sess_length", "hou_majority"),
                                                           years = seq(1999, 2000)))


cspp documentation built on Dec. 28, 2022, 2:46 a.m.