# NOT RUN {
#### create a tree
dst1 <- node_set("firm1")
print(dst1)
## create a tree with children
dst <- node_set(
"firm", NA,
"lab", "cap", dst1
)
print(dst)
#### create a tree with attributes
dst <- node_set("firm", NA,
type = "CD", alpha = 1, beta = c(0.5, 0.5)
)
print(dst, "type", "alpha", "beta")
#### create a tree with attributes and children
dst <- node_set("firm", NA,
type = "CD", alpha = 1, beta = c(0.5, 0.5),
"lab", "cap"
)
print(dst, "type", "alpha", "beta")
#### set attributes for a node
dst.firm <- node_set("firm", NA, "VA")
node_set(dst.firm, "VA",
type = "CD",
alpha = 0.8^-0.8 * 0.2^-0.2,
beta = c(0.8, 0.2),
"lab",
"cap"
)
print(dst.firm, "alpha", "beta")
## set attributes and add a child for a node
node_set(dst.firm, "VA",
type = "SCES",
alpha = 1,
beta = c(0.1, 0.8, 0.1),
es = 0,
"land"
)
print(dst.firm, "type", "alpha", "beta", "es")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab