flat to JSON

Convert flat .csv glossary to a JSON for use with targets pipeline.

library(rjson)
library(stringr)

gloss <- read.csv("../flat/glossary.csv")
gloss <- gloss[order(gloss$Tags),]
gloss_json <-toJSON(gloss)

write(gloss_json, "glossary.json")

#Name
#Definition
#Course Link
#Source Link


gloss_list <- apply(gloss,1,function(x){
  y <-as.list(x)
  y <- list(y)
  names(y)<- unlist(x[1])
  return(y)
})
gloss_list <- unlist(gloss_list,recursive=F)
names(gloss_list) <- NULL
gloss_json <- toJSON(gloss_list)
write(gloss_json, "glossary2.json")

Session

devtools::session_info()


RockefellerUniversity/GlossyBRC documentation built on June 24, 2024, 1:49 a.m.