2 Breakpoint Analysis
This is a breakpoint analysis in R for metal(loid) data obtained from individual coring sites. I used data containing more than 20 metals, and their concentrations at each depth of the impacted core.
My data files can be found in the Github repo, called FileS7_Metalloids_CSM-IMP.csv
and FileS8_Metalloids_CSM-REF.csv
. Access the files here.
2.1 Getting Started
Begin by installing all the required packages using install/packages()
if you haven’t already.
Once installed, load the packages in R
2.2 Load and prepare the data
Load your data for impact and reference sites into R
metals_IMP <- read.csv("Data/FileS6_Metalloids_CSM-IMP.csv")
metals_REF <- read.csv("Data/FileS7_Metalloids_CSM-REF.csv")
Transform the data into long format
metals_long_IMP <- metals_IMP %>%
pivot_longer(!depth, names_to = "metals", values_to = "concentration")
Make sure depth column is numeric