doseresNMA antidep/drnma.plot.net.R

# Figure 1: network 
require(MBNMAdose)
net.plot <- function(data=antidep){
  # Create an mbnma.network object from the data
  data2 <- with(data, data.frame(studyID=studyid,
                               agent=drug,
                               dose=round(dose),
                               r=r,
                               N=n)
              )
  network <- mbnma.network(data2)
  
  # Generate a network plot from the data
  plot(network, 
       level="agent", 
       remove.loops=TRUE,
       label.distance=2.75)
  
}

# Appendix Figure 1: splitted network
require(MBNMAdose)
split.net.plot <- function(data=antidep){
  # Create an mbnma.network object from the data
  data2= with(data, data.frame(studyID=studyid,
                               agent=drug,
                               dose=round(dose),
                               r=r,
                               N=n)
              )
  network <- mbnma.network(data2)
  
  # Generate a network plot from the data
  plot(network, 
       v.color="agent",
       layout=igraph::as_star(), 
       label.distance=4,
       legend.x = 'right')
  
}
htx-r/doseresNMA documentation built on Jan. 28, 2021, 5:32 a.m.