I am new to using json in r and wanted to create map using data from it but so far I am unable to bring it to usable data structure format.
This is what I have tried:
library(jsonlite)
library(tidyverse)
ind_waterways <- jsonlite::fromJSON( url("https://raw.githubusercontent.com/india-in-data/waterways/master/ind_waterways.json"))
ind_waterways
ind_waterways %>%
map_if(is.data.frame, list) %>%
as_tibble() %>%
unnest()
but when I try to unnest it then I get error:
ind_waterways$features %>%
map_if(is.data.frame, list) %>%
as_tibble() %>%
unnest(coordinates)
Error: Can't subset columns that don't exist. x Column
coordinatesdoesn't exist. Runrlang::last_error()to see where the error occurred.