This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(ggplot2)
library(readxl)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.3
##
## 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(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
# Set working directory
setwd("D:/YPI Office/R Analysis/Monitoring Penyu")
# Read data from the 'SMP' sheet
data <- read_excel("Pemantauan Penyu CALK.xlsx", sheet = "SMP")
## New names:
## • `` -> `...32`
## • `` -> `...33`
## • `` -> `...34`
## • `` -> `...35`
## • `` -> `...36`
## • `` -> `...37`
## • `` -> `...38`
## • `` -> `...39`
# Create Year and Quarter columns
data <- data %>%
mutate(`Patrol Start Date` = as.Date(`Patrol Start Date`),
Year = year(`Patrol Start Date`),
Quarter = paste0("Q", quarter(`Patrol Start Date`), "-", Year))
# Summarize number of disturbances per quarter and predator type
rekap <- data %>%
filter(!is.na(Predator)) %>%
group_by(Quarter, Predator) %>%
summarise(Count = n(), .groups = "drop")
# Calculate total and percentage per quarter
total_per_quarter <- rekap %>%
group_by(Quarter) %>%
summarise(Total = sum(Count), .groups = "drop")
rekap_percent <- rekap %>%
left_join(total_per_quarter, by = "Quarter") %>%
mutate(Percent = round((Count / Total) * 100, 2))
# Order the quarters chronologically
quarter_levels <- c("Q1-2024", "Q2-2024", "Q4-2024", "Q1-2025")
rekap_percent$Quarter <- factor(rekap_percent$Quarter, levels = quarter_levels)
# Calculate average percentage per predator category
avg_percent_per_predator <- rekap_percent %>%
group_by(Predator) %>%
summarise(AveragePercent = round(mean(Percent), 2))
Sea Turtle Disturbance Percentage
# Plot 1: Trend of disturbance percentage per quarter (smooth line)
ggplot(rekap_percent, aes(x = Quarter, y = Percent, color = Predator, group = Predator)) +
geom_point(size = 3) +
geom_smooth(method = "loess", se = FALSE, size = 1.2) +
scale_y_continuous(labels = function(x) paste0(x, "%"), limits = c(0, 100)) +
labs(title = "Trend of Sea Turtle Nest Disturbance Percentage per Quarter",
x = "Quarter",
y = "Disturbance Percentage (%)",
color = "Predator Category") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## `geom_smooth()` using formula = 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 0.985
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 1.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 4.0602
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : pseudoinverse used at 0.985
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : neighborhood radius 2.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric = parametric,
## : There are other near singularities as well. 4.0602
Average Sea Turtle Nest Disturbance by Years
# Plot 2: Average disturbance percentage by predator (pie chart)
ggplot(avg_percent_per_predator, aes(x = "", y = AveragePercent, fill = Predator)) +
geom_col(width = 1, color = "white") +
coord_polar(theta = "y") +
labs(title = "Average Sea Turtle Nest Disturbance Percentage by Predator",
fill = "Predator Category") +
theme_void() +
geom_text(aes(label = paste0(AveragePercent, "%")),
position = position_stack(vjust = 0.5),
color = "white", size = 5)
The monitoring results on sea turtle nesting disturbance at CALK reveal the following:
This analysis suggests that human activity poses the most significant threat to nesting success. Conservation strategies should include:
The graphical trends indicate that conservation pressure should be maintained or increased in quarters where human disturbance spikes, such as Q1-2025.