library(tidyverse)
#Load in the dnci values
dnci_df<-read.csv("validation_output/dnci_combined_df.csv")
dnci_df
library(ggplot2)
grepl(dnci_df$group1)
grepl(x=dnci_df$group)
dnci_df%>%
unite(group_pair, c("group1", "group2"))
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot()+
geom_violin(aes(color=group_pair))
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot()+
geom_violin(aes(x=group_pair, y=DNCI))
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot()+
geom_violin(aes(x=group_pair, y=DNCI))%>%
geom_boxplot()
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot()+
geom_violin(aes(x=group_pair, y=DNCI))+
geom_boxplot()
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot()+
geom_violin(aes(x=group_pair, y=DNCI))+
geom_boxplot(aes(x=group_pair, y=DNCI))
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot()+
geom_violin(aes(x=group_pair, y=DNCI, color=group_pair, group = Platform))+
geom_boxplot(aes(x=group_pair, y=DNCI, color=group_pair, group = Platform))
dnci_df%>%
unite(group_pair, c("group1", "group2"))%>%
ggplot(aes(x = group_pair, y = DNCI, color = group_pair)) +
geom_violin(trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, outlier.shape = NA, alpha = 0.6) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "_") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = Platform)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Platform") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
library(cowplot)
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "_") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = Platform)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Platform") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
theme_cowplot()
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "_") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = Platform)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Platform") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
ylim(-4, 0)+
theme_cowplot()
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "_") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = Platform)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Platform") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
ylim(-3.5, 0)+
theme_cowplot()
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = Platform)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Platform") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
ylim(-3.5, 0)+
theme_cowplot()
dnci_df<-read.csv("validation_output/dnci_combined_df.csv")
dnci_df
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "programming_language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))+
ylim(-3.5, 0)+
theme_cowplot()
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-3.5, 0)+
theme_cowplot()
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
theme_minimal() +
labs(x = "Group Pair", y = "DNCI", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-3.5, 0)+
theme_cowplot()
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
labs(x = "Group Pair", y = "DNCI", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-3.5, 0)+
theme_cowplot()
dnci_plot<-dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
labs(x = "Group Pair", y = "DNCI", color = programming_language, fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-3.5, 0)+
theme_cowplot()
dnci_plot<-dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-3.5, 0)+
theme_cowplot()
dnci_plot
ggsave(dnci_plot, "validation_output/dnci_plot.png", dpi=300, width = 10, height = 5)
ggsave("validation_output/dnci_plot.png", dnci_plot, dpi=300, width = 10, height = 5)
ggsave("validation_output/dnci_plot.png", dnci_plot, dpi=300, width = 8, height = 5, bg ="white")
dnci_plot
dnci_df<-read.csv("validation_output/dnci_combined_df.csv")
dnci_plot<-dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")+
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-1, 0)+
theme_cowplot()
library(tidyverse)
library(ggplot2)
library(cowplot)
dnci_plot<-dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")+
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-1, 0)+
theme_cowplot()
dnci_plot
ggsave("validation_output/dnci_plot.pdf", dnci_plot, dpi=300, width = 8, height = 5, bg ="white")
ggsave("/Users/yc2864/Documents/research/MetaCommunityMetrics.jl/docs/src/assets", dnci_plot, dpi=300, width = 8, height = 5, bg ="white")
ggsave("/Users/yc2864/Documents/research/MetaCommunityMetrics.jl/docs/src/assets/dnci_plot.pdf", dnci_plot, dpi=300, width = 8, height = 5, bg ="white")
dnci_df<-read.csv("validation_output/dnci_combined_df.csv")
dnci_plot<-dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")+
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-1, 0)+
theme_cowplot()
dnci_plot
dnci_df
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")+
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
ylim(-1, 0)+
theme_cowplot()
View(dnci_df)
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-")
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language))
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7)
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")
dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")+
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
#ylim(-1, 0)+
theme_cowplot()
read.csv("validation_output/beta_diversity_summary_df.csv")
read.csv("validation_output/prop_patches_summary_df.csv")
read.csv("validation_output/CV_summary_df.csv")
read.csv("validation_output/MVNH_det_summary_df.csv")
read.csv("validation_output/MVNH_dissimilarity_summary_df.csv")
dnci_df<-read.csv("validation_output/dnci_combined_df.csv")
dnci_plot<-dnci_df %>%
unite(group_pair, c("group1", "group2"), sep = "-") %>%
ggplot(aes(x = group_pair, y = DNCI, color = programming_language, fill = programming_language)) +
geom_violin(position = position_dodge(width = 0.9), trim = FALSE, alpha = 0.4) +
geom_boxplot(width = 0.1, position = position_dodge(width = 0.9), outlier.shape = NA, alpha = 0.7) +
geom_hline(yintercept = 0, linetype = "dashed", color = "darkgray")+
labs(x = "Group Pair", y = "DNCI", color = "Programming Language", fill = "Programming Language") +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.position = "bottom")+
#ylim(-1, 0)+
theme_cowplot()
dnci_plot
ggsave("validation_output/dnci_plot.pdf", dnci_plot, dpi=300, width = 8, height = 5, bg ="white")
# Load necessary libraries
library(data.table)
library(tidyverse)
library(bench)
## R packages that provide equivalent functions of my package
library(adespatial)
library(DNCImper)
library(MVNH)
small_df <- read.csv("data_for_testing/small_dataset.csv")
setwd("../data/data_for_testing/")
small_df <- read.csv("data_for_testing/small_dataset.csv")
small_df <- read.csv("small_dataset.csv")
comm_small <- read.csv("comm_small_df.csv")
row_sums <- rowSums(comm_small[, -c(1, 2)])
comm_small_filtered <- comm_small[row_sums != 0, ]
result<-DNCImper:::DNCI_multigroup(comm_small_filtered[, -c(1, 2)],
comm_small_filtered$Group, Nperm = 10,
symmetrize = FALSE,
plotSIMPER = TRUE,
parallelComputing = TRUE)
??DNCImper:::DNCI_multigroup
