work/compare_parts.R

#!/usr/bin/env Rscript

root <- "~/projects/Uezu2016"

library(dplyr)
library(data.table)

parts <- c("surprise", 
	   "significance", 
	   "cpm0", 
	   "cpm1", 
	   "rber0", 
	   "rber1", 
	   "rbconfiguration0", 
	   "rbconfiguration1", 
	   "modularity")

# collect filepaths to partition files in root/rdata
parts_files <- sapply(parts, function(x) {
			      list.files(file.path(root,"rdata"),
					 pattern=x, 
					 full.names=T)
	   })

# load
part_list <- lapply(lapply(parts_files, fread, drop=1),unlist)

# examine total number of modules for each method
k <- sapply(part_list,function(x) length(unique(x)))
k %>% t() %>% knitr::kable()


# Make this into a table:
m = c("Surprise","Significance","CPM","RBER","RBConfiguration","Modularity")
k <- list(35,98,c(2,106),c(2,15),c(2,12),12)
df = data.table(Method=m,
		`Multi-resolution`=c(F,F,T,T,T,F),
		Weighted=c(T,F,T,T,T,T),
		Signed=c(F,F,T,F,F,F),k=k)
df <- df %>% arrange(`Multi-resolution`,`Weighted`,`Signed`)


knitr::kable(df,format="latex")
twesleyb/Uezu2016 documentation built on Jan. 28, 2021, 3:56 p.m.