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:
While I would expect next to each ID to have the respective sex value. Any ideas what might be wrong?
There is a typo: The column name is Sex instead of sex: