Skip to content

Error to transform parent child dataframe #177

@msgoussi

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!

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