'Tree structure with data.tree in R: NAs

I am trying to develop a tree structure in R using data.tree . I am really new in using tree structures. Specifically, I have been following the tutorial: https://cran.r-project.org/web/packages/data.tree/vignettes/data.tree.html#trees-in-data.tree. However, when I am converting to node, the variables referring to each leaf appear to be NA. Specifically, my code is:

library(data.tree)
library(treemap)

library(vcd)
data(Arthritis)
head(Arthritis)
Arthritis$pathString <- paste("progress",
                              Arthritis$Treatment,
                              Arthritis$Improved,
                              Arthritis$ID,
                              sep= "/")

data_arth <- as.Node(Arthritis)
print(data_arth, "sex", limit = 10)

Which gives me:

enter image description here

While I would expect next to each ID to have the respective sex value. Any ideas what might be wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source