Skip to content

When using multiple taxonomies, the order in the json changes #238

@numeroteca

Description

@numeroteca

When using multiple taxonomies, the order in the json changes. This might not be an issue if properly handling json file, but when the json is flattened as I do in R, the order matters.

For example:

"taxonomy_values":{
"Corruption_cases":"Other",
"Frame attack-defense":"Attack"
}

And:

"taxonomy_values":{
"Frame attack-defense":"Attack",
"Corruption_cases":"Gürtel-Valencia"
}

So, before processing them in R we have to be sure they are in the same order.

Load data:

dataorigen <- fromJSON(file="raw-areas.json")
areas <- dataorigen$areas
areas <- lapply(areas, function(x) {
  x[sapply(x, is.null)] <- NA
  unlist(x)
})
# Important: this line flattens the json. and mizes taxonomies
pox <- as.data.frame(do.call("rbind", areas))

So we need to see which is the order of the first row and use it in all the others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions