l1 <- list(a=c(2,3), b=NULL, c=NULL)
# directly using new()
treeharp1 <- new("TreeHarp", adjList = l1, nodeTypes = NA)
# using one of the constructor methods (for lists)
treeharp2 <- TreeHarp(l1)
# using the constructor for matrices.
m1 <- matrix(0L, 3, 3)
dimnames(m1) <- list(letters[1:3], letters[1:3])
m1[1, ] <- c(0, 1L, 1L)
m1[, 1] <- c(0, 1L, 1L)
treeharp3 <- TreeHarp(m1)
# Supplying a language object to get the same tree (with nodeTypes
# populated)
ex1 <- quote(a(b,c))
TreeHarp(ex1, TRUE)
Run the code above in your browser using DataLab