# NOT RUN {
### NOT RUN
# Example 1: Compare modular signal across datasets
# data(pupfish)
# Y.gpa<-gpagen(pupfish$coords, print.progress = FALSE) #GPA-alignment
## landmarks on the body and operculum
# land.gps<-rep('a',56); land.gps[39:48]<-'b'
# group <- factor(paste(pupfish$Pop, pupfish$Sex, sep = "."))
# levels(group)
# coords.gp <- coords.subset(Y.gpa$coords, group)
# modularity.tests <- lapply(1:nlevels(group), function(j) modularity.test(coords.gp[[j]],
# land.gps, iter = 499, print.progress = FALSE))
## the lapply function performs the modularity test on each 3D array in the lists provided
# modularity.tests[[1]]
# modularity.tests[[2]]
# modularity.tests[[3]]
# modularity.tests[[4]]
# group.Z <- compare.CR(modularity.tests, CR.null = FALSE)
# group.Z ## NOTE: need a summary function
# Example 2: Compare alternative modular hypotheses
# land.gps3 <- rep('a',56); land.gps3[39:48]<-'b'; land.gps3[c(6:9,28:38)] <- 'c'
#3 module hypothesis (tail now a module)
# land.gps4 <- rep('a',56); land.gps4[39:48]<-'b'; land.gps4[c(6:9,28:38)] <- 'c';
# land.gps4[c(10,49:56)] <- 'd' #4 module hypothesis (eye now a module)
# m3.test <- modularity.test(coords.gp$Marsh.F,land.gps3, iter = 499, print.progress = FALSE)
# m4.test <- modularity.test(coords.gp$Marsh.F,land.gps4, iter = 499, print.progress = FALSE)
# model.Z <- compare.CR(modularity.tests[[1]],m3.test,m4.test, CR.null = TRUE)
# model.Z
# }
Run the code above in your browser using DataLab