makeDyadic: A Function To Create Dyadic Data Sets

Description Usage Arguments Details Value Author(s) Examples

Description

This function allows the user to create dyadic data sets which can be directed or undirected.

Usage

1
makeDyadic(x, directed = FALSE, show.progress = 5)

Arguments

x

The data matrix whereas the first variable is the country code and the second column has to be the time variable.

directed

Logical. If directed=TRUE the dyadic data set will be directed and have variables with amended names (creating sen_varname for sender and rec_varname for receiver).

show.progress

Logical. The process may take some time depending on the size of the supplied data matrix. This option allows users to receive feedback of how far along the process is at periodical steps. Default is set to 5.

Details

This function was first written for Simon Collrad-Wexler and then later amended for Fabio Wasserfallen.

Value

Returns a data frame with the dyadic data set.

Author(s)

Lucas Leemann lleemann@gmail.com

Examples

1
2
3
4
5
dataOrig <- matrix(c( rep(c(1:4),3), rep(1,4), rep(2,4), rep(3,4),
 rnorm(4,1.5,0.1), rnorm(4,2.5,0.1), rnorm(4,3.5,0.1), rnorm(4,4.5,0.1),
 rnorm(4,5.5,0.1), rnorm(4,6.5,0.1)),12,4)
colnames(dataOrig) <- c("countryCODE", "Year", "Variable 1", "Variable 2")
dataNew <- makeDyadic(dataOrig, directed=TRUE)

Example output

Loading required package: MASS
Loading required package: memisc
Loading required package: lattice

Attaching package: 'memisc'

The following objects are masked from 'package:stats':

    contr.sum, contr.treatment, contrasts

The following object is masked from 'package:base':

    as.array

Loading required package: Formula
Loading required package: mnormt
Loading required package: pbivnorm

StratSel documentation built on May 2, 2019, 11:11 a.m.