Pajek 2 NetsJSON

> wdir <- "C:/Users/batagelj/Downloads/data/CoMuNe/pajek"
> setwd(wdir)
> library(rjson)
> source("https://raw.githubusercontent.com/bavla/Linked/master/source/Pajek.R")
> p <- clu2vector("https://raw.githubusercontent.com/bavla/Linked/master/data/PNAS1.clu")
> N <- net2pairs("https://raw.githubusercontent.com/bavla/Linked/master/data/PNAS1.net")
> n <- length(N$nodes); m <- length(N$links)
> for(i in 1:n) N$nodes[[i]]$mode <- p[i]
> N$info['network'] <- "PNAS1"; N$info['mode'] <- 2
> N['NetsJSON'] <- 'basic'
> json <- file("PNAS1.json","w"); cat(toJSON(N),file=json); close(json)
vlado/work/data/paj2json.txt · Last modified: 2020/06/17 23:40 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki