library(ggplot2)
library(ggpubr)
library(tidyverse)
library(broom)
library(AICcmodavg)
my_data <- read.table(file = "clipboard",
sep = "\t", header=TRUE)
my_data %>%
mutate(across(CO2, ~ suppressWarnings(as.numeric(.)))) %>%
group_by(habitat) %>%
summarise(
count = n(),
mean = mean(CO2, na.rm = TRUE),
sd = sd(CO2, na.rm = TRUE) )
#library("ggpubr")
ggboxplot(my_data, x = "habitat", y = "CO2",
color = "habitat", palette = c("#00AFBB", "#E7B800", "#FC4E07", "#0080FF"),
order = c( "Bog", "Fen", "Peatland", "Woodland" ), main="Carbon Abatement in Restored Habitats",
ylab = "Carbon Abatement(t CO2e ha-1 y-1) ", xlab = "Habitat")
res.aov <- aov(co2~ habitat, data = my_data)
summary(res.aov)
Running an ANOVA test and I keep getting the following error- Error in model.frame.default(formula = co2 ~ habitat, data = my_data, : variable lengths differ (found for 'habitat')
Previously this code worked when I used it some weeks ago, but running it again without any changes seems to result in the following issue. What could the problem be? Have seen other similar questions but struggling to relate. Thanks! Dataset: enter image description here