tests/testthat/helper_toy_data.R

### Create Test Data

A1 <- matrix(c(0,1,0,0,0,0,
               1,0,1,0,0,0,
               0,1,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0), ncol=6)
A2 <- matrix(c(0,0,0,0,0,0,
               0,0,1,0,0,0,
               0,1,0,1,1,0,
               0,0,1,0,0,0,
               0,0,1,0,0,0,
               0,0,0,0,0,0), ncol=6)
A3 <- matrix(c(0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0), ncol=6)
A4 <- matrix(c(0,1,0,0,0,0,
               1,0,0,1,0,0,
               0,0,0,0,0,0,
               0,1,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0), ncol=6)
A5 <- matrix(c(0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,1,0,0,
               0,0,1,0,1,0,
               0,0,0,1,0,0,
               0,0,0,0,0,0), ncol=6)
A6 <- matrix(c(0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,0,
               0,0,0,0,0,1,
               0,0,0,0,1,0), ncol=6)


As <- list(A1,A2,A3,A4,A5,A6)
numberNodes <- ncol(As[[1]])

Es <- lapply(seq_along(As), function(i){
  sapply(1:numberNodes, function(j){which(As[[i]][j,]==1)})
})

Try the TNC package in your browser

Any scripts or data that you put into this service are public.

TNC documentation built on May 2, 2019, 4:02 p.m.