Complex Data analysis

I ran a Jaccard analysis on a set of Data of mine looking at Salmonella populations at 3 creek sites. I went sampling after it had been dry for 3 days, and also after rain. I want to know if the populations differ signifigantly between the wet/dry samplings. A Jaccard analysis measures beta diversity and compares every sample to every other sample producing essentially, a triangular matrix. I have been procrastinating on figureing out how to analyze and present this data for several months, so we’re doing it now. Based on some readings I have done, the typical test for something like this is a PERMANOVA. My current plan: load my matrix, load a thing denotating which samples are dry/wet, then figure out how to use these vectors and the matrix for the PERMANOVA. I hope this counts as complex data.

Load Libraries

library(dplyr) #for data processing/cleaning

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(tidyr) #for data processing/cleaning
library(here) #to set paths
here() starts at C:/Users/esthe/Documents/GitHub/EstherPalmer-portfolio
library(vegan) #this is a package that allows me to do a PERMANOVA I think
Loading required package: permute

This loads all the libraries I need for this project

Load Data

data_location <- here::here("data-exercise", "CC_CSS_Jaccard2.csv")
jmatrix <- read.csv(data_location, row.names = 1)
#note to future self, do not populate row.names with the () version, use row.names = for it to work

This cell loads the output of my Jaccard analysis Note: I still need to redo the Jaccard with the last of my CSS files, so this is not final data.

Load Vectors

dry.wet_location <- here::here("data-exercise", "Samples_wet_dry.csv")
dry.wet <- read.csv(dry.wet_location, header = TRUE)

This cell loads a file that denotes which samples are wet or dry

result <- adonis2(jmatrix ~ Wet.Dry, dry.wet, permutations = 999, method = "jaccard")
#this should run the permanova test using the adonis2 formula in the vegan package
print(result)
Permutation test for adonis under reduced model
Permutation: free
Number of permutations: 999

adonis2(formula = jmatrix ~ Wet.Dry, data = dry.wet, permutations = 999, method = "jaccard")
         Df SumOfSqs      R2     F Pr(>F)   
Model     1   0.5476 0.02781 2.718  0.008 **
Residual 95  19.1388 0.97219                
Total    96  19.6864 1.00000                
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

I did something! I have no idea what the printed result fully means though. It looks like it might be signifigant? Theoretically this should compare all the wet samplings against all the dry samplings and see if there’s significant differences between the two groups.