Description Usage Arguments Examples
View source: R/create-lineup.R
Create a function to randomly place a data plot among null plots.
1 | create_lineup(sims, dat, sd = NULL)
|
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. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.