How to Create dataframe from hierarchy dataframe?

I am trying to create dataframe from hierachy dataframe (STIC4) and i get an error. however if I read STIC sheet, everything works fine

utils::browseURL("https://unstats.un.org/unsd/classifications/Econ")

utils::download.file("https://unstats.un.org/unsd/classifications/Econ/Download/In%20Text/SITCCodeandDescription.xlsx", "SITCCodeandDescription.xlsx",
                     mode = "wb", quiet = TRUE)

dt1 <- readxl::read_excel("SITCCodeandDescription.xlsx", "SITC4") %>% 
  dplyr::rename_with(tolower)

dt2 <- dt1 %>% 
  dplyr::select(parent = "parent code", child = code)  %>% 
  tidyr::drop_na() %>% 
  data.tree::FromDataFrameNetwork() %>% 
  data.tree::ToDataFrameTypeCol()

Error in data.tree::FromDataFrameNetwork(.) :
Cannot find root name. network is not a tree!

dt1 is a data.frame—well technically a 'tibble' but basically it is a data.frame. Can you explain a bit more what you want to achieve?

if you are reading sheet SITC3, dt2 will be similar to this image

ie transfer dataframe or tibble from parent child to all levels

if you are reading sheet SITC3, dt2 will be similar to this image.
Yes, I get the same. I get SITC1, SITC3, & SITC3 to process.

At the moment I'd guess that you have a non-compliant file. There may be a typo or something in the file but I don't know enough about {data.tree} or the UN's file structures to know how to check it.

Maybe a query to the responsible people at the UN?

I need to figure out what is the problem to contact UNSD.

I think you have found enough to bring the issue to UNSD's attention. If you can successfully convert 3 out of 4 data.frames then this seems enough to alert UNSD to a serious problem in one of their data sets.