I transformed the XML file wiring.xml
from CASOS into the CSV file wiring.csv
Roethlisberger & Dickson Bank Wiring Room http://vlado.fmf.uni-lj.si/pub/networks/data/ucinet/ucidata.htm http://www.casos.cs.cmu.edu/computational_tools/datasets/external/wiring/index11.php nodes: I1,I3,W1,W2,W3,W4,W5,W6,W7,W8,W9,S1,S2,S4, source;target;relation;w I1;W1;RDGAM;1 I1;W2;RDGAM;1 I1;W3;RDGAM;1 I1;W4;RDGAM;1 W1;I1;RDGAM;1 ...
> wdir <- "C:/Users/vlado/DL/data/multi/cores/wire" > setwd(wdir) > library(jsonlite) > D <- read.csv2("wiring.csv",skip=4,stringsAsFactors=FALSE) > str(D) 'data.frame': 189 obs. of 4 variables: $ source : chr "I1" "I1" "I1" "I1" ... $ target : chr "W1" "W2" "W3" "W4" ... $ relation: chr "RDGAM" "RDGAM" "RDGAM" "RDGAM" ... $ w : int 1 1 1 1 1 1 1 1 1 1 ... > V <- c("I1","I3","W1","W2","W3","W4","W5","W6","W7","W8","W9","S1","S2","S4") > R <- c("RDGAM","RDCON","RDPOS","RDNEG","RDHLP","RDJOB") > u <- as.integer(factor(D$source,level=V)); v <- as.integer(factor(D$target,level=V)) > r <- as.integer(factor(D$relation,level=R)) > L <- data.frame(P1=u,P2=v,R=r,w=D$w) > info <- list(network="Wiring Room", + title="Roethlisberger & Dickson Bank Wiring Room", + by="Roethlisberger F. and Dickson W.", + ref="Roethlisberger F. and Dickson W. (1939). Management and the worker. Cambridge: Cambridge University Press", + href="http://vlado.fmf.uni-lj.si/pub/networks/data/ucinet/ucidata.htm", + creator="V. Batagelj", + date=date() ) > ways=list(P1="first person",P2="second person",R="relation") > nodes=list(P1=data.frame(ID=V),P2=data.frame(ID=V),R=data.frame(ID=R)) > MN <- list(format="MWnets",info=info,ways=ways,nodes=nodes,links=L,data=list()) > str(MN) List of 6 $ format: chr "MWnets" $ info :List of 7 ..$ network: chr "Wiring Room" ..$ title : chr "Roethlisberger & Dickson Bank Wiring Room" ..$ by : chr "Roethlisberger F. and Dickson W." ..$ ref : chr "Roethlisberger F. and Dickson W. (1939). Management and the worker. Cambridge: Cambridge University Press" ..$ href : chr "http://vlado.fmf.uni-lj.si/pub/networks/data/ucinet/ucidata.htm" ..$ creator: chr "V. Batagelj" ..$ date : chr "Sun Sep 24 04:23:20 2023" $ ways :List of 3 ..$ P1: chr "first person" ..$ P2: chr "second person" ..$ R : chr "relation" $ nodes :List of 3 ..$ P1:'data.frame': 14 obs. of 1 variable: .. ..$ ID: chr [1:14] "I1" "I3" "W1" "W2" ... ..$ P2:'data.frame': 14 obs. of 1 variable: .. ..$ ID: chr [1:14] "I1" "I3" "W1" "W2" ... ..$ R :'data.frame': 6 obs. of 1 variable: .. ..$ ID: chr [1:6] "RDGAM" "RDCON" "RDPOS" "RDNEG" ... $ links :'data.frame': 189 obs. of 4 variables: ..$ P1: int [1:189] 1 1 1 1 3 3 3 3 3 3 ... ..$ P2: int [1:189] 3 4 5 6 1 4 5 6 7 12 ... ..$ R : int [1:189] 1 1 1 1 1 1 1 1 1 1 ... ..$ w : int [1:189] 1 1 1 1 1 1 1 1 1 1 ... $ data : list() > write(toJSON(MN),"WiringRoom.json")
Github JSON
> wdir <- "C:/Users/vlado/DL/data/multi/cores/wire" > setwd(wdir) > library(jsonlite) > source("https://raw.githubusercontent.com/bavla/Rnet/master/R/Pajek.R") > source("https://raw.githubusercontent.com/bavla/ibm3m/master/multiway/MWnets.R") > WR <- fromJSON("https://raw.githubusercontent.com/bavla/ibm3m/master/data/WiringRoom.json") > str(WR)