# NOT RUN {
# R-vine structures can be constructed from the order vector and struct_array
rvine_structure(order = 1:4, struct_array = list(
c(4, 4, 4),
c(3, 3),
2
))
# ... or a similar list can be coerced into an R-vine structure
as_rvine_structure(list(order = 1:4, struct_array = list(
c(4, 4, 4),
c(3, 3),
2
)))
# similarly, standard matrices can be coerced into R-vine structures
mat <- matrix(c(4, 3, 2, 1, 4, 3, 2, 0, 4, 3, 0, 0, 4, 0, 0, 0), 4, 4)
as_rvine_structure(mat)
# or truncate and construct the structure
mat[3, 1] <- 0
as_rvine_structure(mat)
# throws an error
mat[3, 1] <- 5
try(as_rvine_structure(mat))
# }
Run the code above in your browser using DataCamp Workspace