I'm having trouble understanding how to create a data.tree from a data frame. I have a data frame with two columns:
- EmpID
- SupervisorUserID
Code:
OfficeOrg <- read_csv("hierarchy")
OfficeOrg$pathString <- paste("Root",
OfficeOrg$SupervisorEmpID, OfficeOrg$EmpID, sep = "/")
RptTree <- as.Node(OfficeOrg)
The sample data has 25 rows. By inspecting the data, I can see that there are five levels. That is to say, I expect the RptTree object to show EmpIDs grouped under SupervisorEmpID to a depth of five.
Root
|_TopLevelSupervisor
|_SecondLevelSupervisor
|_ThirdLevelSupervisor
|_Employee
Instead, I see only three levels. The root, one for each SupervisorEmpID and the employees.
Root
|_Supervisor
|_ Employee
The tree isn't being built by recursing through all levels. Usually this means that I'm staring something in the face, but not recognizing it.
What am I missing?