# NOT RUN {
# Each element in the supplied the vector has 4 child.
nest_in(1:3, 4)
# prefix and suffix can be added to child labels
# along with other aesthesitics like leading zeroes
# with minimum number of digits.
nest_in(1:3, 10, prefix = "id-", suffix = "xy", leading0 = 4)
# you can specify unbalanced nested structures
nest_in(2:4,
1 ~ 3,
2 ~ 4,
3 ~ 2)
# A `.` may be used to specify "otherwise".
nest_in(c("A", "B", "C", "D"),
2:3 ~ 10,
. ~ 3)
# The parental level can be referred by its name or vectorised.
nest_in(c("A", "B", "C"),
c("A", "B") ~ 10,
"C" ~ 3)
# }
Run the code above in your browser using DataLab