create_lineup: Create a function to randomly place a data plot among null...

Description Usage Arguments Examples

View source: R/create-lineup.R

Description

Create a function to randomly place a data plot among null plots.

Usage

1
create_lineup(sims, dat, sd = NULL)

Arguments

sims

data frame from the sims_to_df function. Only one wave at a time permitted, so it must be subset. Must have columns from, to, and sim at least.

dat

the data you wish to plot among the sims randomly. Must have same column names as the sims data. The sim column must have the value "dat".

sd

seed. Use for setting a random seed for reproducibility. Defaults to NULL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
M1sims5df <- sims_to_df(M1sims5)
wave2 <- read.table("data/s50-network2.dat")
wave2$from <- 1:50
tidyr::gather(wave2, key = to, value = tie, V1:V50) %>%
dplyr::mutate(to = readr::parse_number(to)) %>%
dplyr::filter(tie == 1) -> wave2df
wave2df <- merge(wave2df, data.frame(id = 1:50), by.x = "from", by.y = "id", all = T)
wave2df$tie <- "dat"
names(wave2df)[3] <- "sim"
M1sims5df <- M1sims5df[c(1,2,5)]
test <- create_lineup(M1sims5df, wave2df)

sctyner/netvizinf documentation built on May 29, 2019, 4:20 p.m.