Code
library(tidyverse)
library(readxl) # for importing excel files
library(patchwork) # combining plotsWe compared how long it took shrimp from four treatment groups to contact shelter after being placed in an unfamiliar environment.
library(tidyverse)
library(readxl) # for importing excel files
library(patchwork) # combining plotsImport data.
data <- read_xlsx("data/kingston-data.xlsx", sheet = "A", skip = 1)
glimpse(data)Rows: 30
Columns: 5
$ Animal <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1…
$ `Unarmored Experimental (UE)` <dbl> 16, 8, 14, 5, 55, 118, 12, 11, 240, 269,…
$ `Armored Experimental (AE)` <dbl> 13, 15, 1, 119, 5, 11, 4, 4, 3, 3, 4, 9,…
$ `Unarmored Control (UC)` <dbl> 2, 6, 2, 11, 6, 3, 4, 4, 8, 8, 78, 5, 4,…
$ `Armored Control (AC)` <dbl> 8, 9, 4, 4, 5, 58, 11, 2, 18, 15, 8, 41,…
data# A tibble: 30 × 5
Animal Unarmored Experimental…¹ Armored Experimental…² Unarmored Control (U…³
<dbl> <dbl> <dbl> <dbl>
1 1 16 13 2
2 2 8 15 6
3 3 14 1 2
4 4 5 119 11
5 5 55 5 6
6 6 118 11 3
7 7 12 4 4
8 8 11 4 4
9 9 240 3 8
10 10 269 3 8
# ℹ 20 more rows
# ℹ abbreviated names: ¹`Unarmored Experimental (UE)`,
# ²`Armored Experimental (AE)`, ³`Unarmored Control (UC)`
# ℹ 1 more variable: `Armored Control (AC)` <dbl>
Describe and provide data summaries to inform reader how many animals per treatment.
tidy_data <- data %>%
pivot_longer(cols = -Animal,
names_to = "treatment",
values_to = "time") %>%
separate(treatment, sep = "[(]", into = c("treatment_full", "treatment")) %>%
mutate(treatment = str_replace(treatment, "[)]", ""),
treatment_full = str_trim(treatment_full))Create figures that support these claims:
Shrimp without orbital hoods that were exposed to shock waves took longer to contact their burrows than shrimp with orbital hoods that were exposed to shock waves, shrimp without orbital hoods that were not exposed to shock waves, or shrimp with orbital hoods that were not exposed to shock waves. Animals in the AE, UC, and AC treatments did not differ in how long they took to contact their burrows.
See Figure 1.
g1 <- ggplot(tidy_data, aes(treatment, time)) +
geom_boxplot() +
scale_y_log10() +
labs(tag = "(A)")
g2 <- ggplot(tidy_data, aes(treatment, log10(time))) +
geom_boxplot() +
labs(tag = "(B)")
g1 + g2We measured how long it took individuals to achieve a normal upright posture following their release into the behavioral arena. Shrimp in the UE treatment took longer to become upright than animals in the AE, UC, or AC treatments. Animals in the AE, UC, and AC treatments did not differ in how long they took to achieve a normal posture.
In test subjects with unaltered orbital hoods, shock waves recorded internally always had lower magnitudes than those recorded externally (Data S1C). When we removed orbital hoods from test subjects, shock waves varied in whether they had higher magnitudes internally or externally (Data S1C).