Skip to content

Error to transform parent child dataframe #177

Description

@msgoussi

I am trying to create dataframe from hierachy dataframe (STIC4) and i get an error. however if I read STIC3 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) %>%
dplyr::select(parent = "parent code", child = code) %>%
tidyr::drop_na() %>%
data.tree::FromDataFrameNetwork() %>%
data.tree::ToDataFrameTypeCol()

Error is

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions