ggarrange() resulting in object of type 'closure' is not subsettable

I have created multiple ggplots and they all come out fine. But when I try to use the ggarrange() funciton to combine them I am receiving an error that the object of type 'closure' is not subsettable. I showed one example of how I edited the csv to get the plot, the others were done the same way but I left them out to save some space. All the plots on their own worked fine, it's just when I tried to assign the plots to a variable (ex a<-ggplot...) and then use the ggarrange() that errored.

CSV info:

> dput(organic_acids)
structure(list(Experiment.ID = c("Oct19-Queue-T0", "Oct19-Queue-B-T0", 
"Oct19-Aer-T4-1", "Oct19-Aer-T4-2", "Oct19-Aer-T4-3", "Oct19-Aer-T12-1", 
"Oct19-Aer-T12-2", "Oct19-Aer-T12-3", "Oct19-Aer-T24-1", "Oct19-Aer-T24-2", 
"Oct19-Aer-T24-3", "Oct19-Aer-28d-1", "Oct19-Aer-28d-2", "Oct19-Aer-28d-3", 
"Oct19-Ana-T4-1", "Oct19-Ana-T4-2", "Oct19-Ana-T4-3", "Oct19-Ana-T12-1", 
"Oct19-Ana-T12-2", "Oct19-Ana-T12-3", "Oct19-Ana-T24-1", "Oct19-Ana-T24-2", 
"Oct19-Ana-T24-3", "Oct19-Ana-28d-2", "Oct19-Ana-28d-3", "Oct19-B-T4-1", 
"Oct19-B-T4-2", "Oct19-B-T4-3", "Oct19-B-T12-1", "Oct19-B-T12-2", 
"Oct19-B-T12-3", "Oct19-B-T24-1", "Oct19-B-T24-2", "Oct19-B-T24-3", 
"Oct19-B-28d-1", "Oct19-B-28d-2", "Oct19-B-28d-3"), OA.sample.name = c("T0 A&B", 
"CA T0 A&B", "Aer T4 1A&B", "Aer T4 2A&B", "Aer T4 3A&B", "Aer T8 1A&B", 
"Aer T8 2A&B", "Aer T8 3A&B", "Aer T24 1A&B", "Aer T24 2A&B", 
"Aer T24 3A&B", "Oct19-Aer-28d-1", "Oct19-Aer-28d-2", "Oct19-Aer-28d-3", 
"An T4 1A&B", "An T4 2A&B", "An T4 3A&B", "An T8 1A&B", "An T8 2A&B", 
"An T8 3A&B", "An T24 1A&B", "An T24 2A&B", "An T24 3A&B", "Oct19-Ana-28d-2", 
"Oct19-Ana-28d-3", "CA T4 1A&B", "CA T4 2A&B", "CA T4 3A&B", 
"CA T8 1A&B", "CA T8 2A&B", "CA T8 3A&B", "CA T24 1A&B", "CA T24 2A&B", 
"CA T24 3A&B", "Oct19-B-28d-1", "Oct19-B-28d-2", "Oct19-B-28d-3"
), Sample_overview = c("Initial biomass", "Initial biomass with CA", 
"Aer_4hr", "Aer_4hr", "Aer_4hr", "Aer_8hr", "Aer_8hr", "Aer_8hr", 
"Aer_24hr", "Aer_24hr", "Aer_24hr", "Aer_28day", "Aer_28day", 
"Aer_28day", "Ana_4hr", "Ana_4hr", "Ana_4hr", "Ana_8hr", "Ana_8hr", 
"Ana_8hr", "Ana_24hr", "Ana_24hr", "Ana_24hr", "Ana_28day", "Ana_28day", 
"CA_4hr", "CA_4hr", "CA_4hr", "CA_8hr", "CA_8hr", "CA_8hr", "CA_24hr", 
"CA_24hr", "CA_24hr", "CA_28day", "CA_28day", "CA_28day"), pH = c(6.24, 
5.34, 6.35, 6.36, 6.36, 6.42, 6.38, 6.41, 6.4, 6.4, 6.43, 6.35, 
6.37, 6.37, 6.34, 6.35, 6.3, 6.38, 6.36, 6.38, 6.28, 6.33, 6.29, 
6.55, 6.51, 4.74, 4.73, 4.75, 4.85, 4.86, 4.79, 6.74, 6.79, 6.72, 
4.69, 4.67, 4.64), Wet.Biomass.extracted = c(0.9722, 1.2766, 
0.923, 1.1819, 0.908, 0.9389, 0.7588, 1.0399, 0.8874, 1.2909, 
1.9329, 1.1952, 1.3727, 1.2854, 1.2349, 1.6384, 0.8754, 1.5515, 
1.5482, 1.0966, 1.4808, 1.1908, 1.3238, 1.5554, 1.9348, 0.8947, 
0.5476, 1.1744, 0.9564, 0.985, 1.0043, 1.7569, 1.7615, 1.7494, 
1.4672, 1.5015, 1.8487), Moisture.content = c("75.20%", "75.07%", 
"76.65%", "77.00%", "76.60%", "75.67%", "75.83%", "76.04%", "76.21%", 
"76.18%", "76.26%", "80.29%", "82.17%", "81.54%", "75.95%", "76.02%", 
"76.10%", "76.10%", "76.14%", "75.94%", "76.02%", "76.31%", "76.26%", 
"81.13%", "80.51%", "75.09%", "74.99%", "74.53%", "75.18%", "74.94%", 
"75.25%", "75.29%", "75.60%", "75.05%", "77.00%", "76.28%", "76.57%"
), Dry.Biomass.extracted = c(0.241, 0.318, 0.216, 0.271, 0.213, 
0.228, 0.183, 0.249, 0.211, 0.307, 0.459, 0.236, 0.245, 0.237, 
0.297, 0.393, 0.209, 0.371, 0.369, 0.264, 0.355, 0.282, 0.314, 
0.294, 0.377, 0.223, 0.137, 0.299, 0.237, 0.247, 0.249, 0.434, 
0.43, 0.437, 0.337, 0.356, 0.433), pH_avg = c(6.24, 5.34, 6.356666667, 
NA, NA, 6.403333333, NA, NA, 6.41, NA, NA, 6.363333333, NA, NA, 
6.33, NA, NA, 6.373333333, NA, NA, 6.3, NA, NA, 6.53, NA, 4.74, 
NA, NA, 4.833333333, NA, NA, 6.75, NA, NA, 4.666666667, NA, NA
), pH_stdev = c(NA, NA, 0.005773503, NA, NA, 0.02081666, NA, 
NA, 0.017320508, NA, NA, 0.011547005, NA, NA, 0.026457513, NA, 
NA, 0.011547005, NA, NA, 0.026457513, NA, NA, 0.028284271, NA, 
0.01, NA, NA, 0.037859389, NA, NA, 0.036055513, NA, NA, 0.025166115, 
NA, NA), DB_avg = c(0.241, 0.318, 0.233, NA, NA, 0.22, NA, NA, 
0.326, NA, NA, 0.239, NA, NA, 0.3, NA, NA, 0.335, NA, NA, 0.317, 
NA, NA, 0.335, NA, 0.22, NA, NA, 0.244, NA, NA, 0.433, NA, NA, 
0.376, NA, NA), DB_stdev = c(NA, NA, 0.033107707, NA, NA, 0.033624845, 
NA, NA, 0.124875012, NA, NA, 0.004852549, NA, NA, 0.091872197, 
NA, NA, 0.061345299, NA, NA, 0.03656458, NA, NA, 0.059105729, 
NA, 0.081131907, NA, NA, 0.006033065, NA, NA, 0.00342562, NA, 
NA, 0.050677858, NA, NA), MC_avg = c("75.20%", "75.10%", "76.75%", 
"", "", "75.85%", "", "", "76.22%", "", "", "81.34%", "", "", 
"76.02%", "", "", "76.06%", "", "", "76.20%", "", "", "80.82%", 
"", "74.87%", "", "", "75.12%", "", "", "75.31%", "", "", "76.62%", 
"", ""), MC_stdev = c(NA, NA, 0.00248928, NA, NA, 0.001855378, 
NA, NA, 0.000394331, NA, NA, 0.009579579, NA, NA, 0.000747561, 
NA, NA, 0.001063373, NA, NA, 0.001546329, NA, NA, 0.004382132, 
NA, 0.00299443, NA, NA, 0.001631437, NA, NA, 0.002782886, NA, 
NA, 0.003635063, NA, NA), Succinic.Acid = c("0.23%", "0.22%", 
"2.97%", "2.02%", "2.03%", "2.62%", "3.42%", "2.51%", "2.42%", 
"1.96%", "0.36%", "0.36%", "1.28%", "0.41%", "0.76%", "0.26%", 
"1.13%", "1.74%", "1.78%", "2.84%", "1.74%", "2.89%", "1.65%", 
"0.80%", "1.22%", "2.34%", "2.67%", "1.14%", "1.85%", "1.99%", 
"1.91%", "1.88%", "1.76%", "1.75%", "22.88%", "36.51%", "29.64%"
), Lactic.Acid = c("0.00%", "0.00%", "0.03%", "0.01%", "0.01%", 
"0.03%", "0.02%", "0.06%", "0.08%", "0.03%", "0.00%", "0.22%", 
"0.22%", "0.00%", "0.00%", "0.00%", "0.01%", "0.02%", "0.01%", 
"0.02%", "0.06%", "0.11%", "0.03%", "0.22%", "0.39%", "0.18%", 
"0.16%", "0.08%", "0.32%", "0.30%", "0.32%", "0.30%", "0.28%", 
"0.27%", "1.67%", "1.04%", "1.20%"), Formic.Acid = c("0.00%", 
"0.00%", "0.04%", "0.02%", "0.01%", "0.05%", "0.05%", "0.06%", 
"0.02%", "0.03%", "0.00%", "0.21%", "0.55%", "0.24%", "0.00%", 
"0.00%", "0.02%", "0.06%", "0.06%", "0.07%", "0.05%", "0.07%", 
"0.05%", "0.08%", "0.47%", "0.07%", "0.06%", "0.03%", "0.05%", 
"0.05%", "0.06%", "0.04%", "0.04%", "0.04%", "0.46%", "0.43%", 
"0.40%"), Acetic.Acid = c("0.02%", "0.01%", "0.09%", "0.03%", 
"0.03%", "0.09%", "0.16%", "0.03%", "0.14%", "0.09%", "0.00%", 
"3.82%", "6.74%", "4.50%", "0.01%", "0.00%", "0.04%", "0.02%", 
"0.02%", "0.09%", "0.02%", "0.08%", "0.02%", "3.61%", "2.51%", 
"0.01%", "0.01%", "0.00%", "0.01%", "0.01%", "0.01%", "0.02%", 
"0.02%", "0.01%", "2.31%", "2.96%", "2.21%"), Propionic.Acid = c("0.05%", 
"0.04%", "0.88%", "0.62%", "0.61%", "0.90%", "1.04%", "0.90%", 
"0.90%", "0.83%", "0.16%", "3.51%", "2.85%", "3.46%", "0.26%", 
"0.09%", "0.36%", "0.60%", "0.55%", "0.96%", "0.63%", "0.93%", 
"0.56%", "3.04%", "2.52%", "0.78%", "0.80%", "0.45%", "0.79%", 
"0.77%", "0.79%", "0.66%", "0.61%", "0.59%", "2.31%", "1.94%", 
"2.02%"), Isobutyric.Acid = c("0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.17%", "0.34%", "0.22%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.02%", "0.05%", 
"0.00%", "0.00%", "0.01%", "0.00%", "0.02%", "0.01%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%"), Butyric.Acid = c("0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.01%", "0.01%", "0.00%", 
"0.03%", "0.03%", "0.00%", "3.26%", "5.67%", "3.88%", "0.00%", 
"0.00%", "0.00%", "0.01%", "0.01%", "0.02%", "0.02%", "0.04%", 
"0.02%", "2.74%", "2.26%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.09%", 
"0.00%"), Isovaleric.Acid = c("0.00%", "0.00%", "0.00%", "0.01%", 
"0.01%", "0.02%", "0.03%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.91%", "1.16%", "0.84%", "0.01%", "0.00%", "0.01%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.58%", "0.26%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.01%", "0.00%", "0.00%", 
"0.00%", "0.00%", "3.46%", "1.03%", "2.94%"), Valeric.Acid = c("0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.98%", "1.41%", "1.56%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", "0.00%", 
"0.00%"), Organic.Acid = c("0.30%", "0.27%", "4.01%", "2.72%", 
"2.71%", "3.72%", "4.72%", "3.56%", "3.60%", "2.98%", "0.52%", 
"13.44%", "20.24%", "15.12%", "1.03%", "0.35%", "1.55%", "2.45%", 
"2.42%", "4.01%", "2.54%", "4.11%", "2.31%", "11.10%", "9.69%", 
"3.39%", "3.69%", "1.71%", "3.01%", "3.15%", "3.10%", "2.89%", 
"2.71%", "2.67%", "33.09%", "44.01%", "38.41%"), SA_avg = c("0.23%", 
"0.22%", "2.34%", "", "", "2.85%", "", "", "1.58%", "", "", "0.68%", 
"", "", "0.71%", "", "", "2.12%", "", "", "2.10%", "", "", "1.01%", 
"", "2.05%", "", "", "1.92%", "", "", "1.79%", "", "", "29.68%", 
"", ""), LA_avg = c("0.00%", "0.00%", "0.02%", "", "", "0.04%", 
"", "", "0.04%", "", "", "0.15%", "", "", "0.00%", "", "", "0.02%", 
"", "", "0.07%", "", "", "0.30%", "", "0.14%", "", "", "0.31%", 
"", "", "0.28%", "", "", "1.30%", "", ""), FA_avg = c("0.00%", 
"0.00%", "0.03%", "", "", "0.05%", "", "", "0.02%", "", "", "0.34%", 
"", "", "0.01%", "", "", "0.06%", "", "", "0.06%", "", "", "0.27%", 
"", "0.05%", "", "", "0.06%", "", "", "0.04%", "", "", "0.43%", 
"", ""), AA_avg = c("0.02%", "0.01%", "0.05%", "", "", "0.10%", 
"", "", "0.08%", "", "", "5.02%", "", "", "0.02%", "", "", "0.04%", 
"", "", "0.04%", "", "", "3.06%", "", "0.01%", "", "", "0.01%", 
"", "", "0.02%", "", "", "2.49%", "", ""), PA_avg = c("0.05%", 
"0.04%", "0.70%", "", "", "0.95%", "", "", "0.63%", "", "", "3.27%", 
"", "", "0.23%", "", "", "0.70%", "", "", "0.71%", "", "", "2.78%", 
"", "0.68%", "", "", "0.78%", "", "", "0.62%", "", "", "2.09%", 
"", ""), IBA_avg = c("0.00%", "0.00%", "0.00%", "", "", "0.00%", 
"", "", "0.00%", "", "", "0.25%", "", "", "0.00%", "", "", "0.00%", 
"", "", "0.00%", "", "", "0.04%", "", "0.00%", "", "", "0.01%", 
"", "", "0.00%", "", "", "0.00%", "", ""), BA_avg = c("0.00%", 
"0.00%", "0.00%", "", "", "0.01%", "", "", "0.02%", "", "", "4.27%", 
"", "", "0.00%", "", "", "0.01%", "", "", "0.03%", "", "", "2.50%", 
"", "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", "0.03%", 
"", ""), IVA_avg = c("0.00%", "0.00%", "0.01%", "", "", "0.02%", 
"", "", "0.00%", "", "", "0.97%", "", "", "0.00%", "", "", "0.00%", 
"", "", "0.00%", "", "", "0.42%", "", "0.00%", "", "", "0.00%", 
"", "", "0.00%", "", "", "2.48%", "", ""), VA_avg = c("0.00%", 
"0.00%", "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", "1.32%", 
"", "", "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", "0.00%", 
"", "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", "0.00%", 
"", ""), OA_total_avg = c("0.30%", "0.27%", "3.15%", "", "", 
"4.00%", "", "", "2.37%", "", "", "16.27%", "", "", "0.98%", 
"", "", "2.96%", "", "", "2.99%", "", "", "10.39%", "", "2.93%", 
"", "", "3.09%", "", "", "2.76%", "", "", "38.50%", "", ""), 
    SA_stdev = c("0.00%", "0.00%", "0.55%", "", "", "0.50%", 
    "", "", "1.08%", "", "", "0.52%", "", "", "0.43%", "", "", 
    "0.62%", "", "", "0.69%", "", "", "0.30%", "", "0.80%", "", 
    "", "0.07%", "", "", "0.07%", "", "", "6.81%", "", ""), LA_stdev = c("0.00%", 
    "0.00%", "0.01%", "", "", "0.02%", "", "", "0.04%", "", "", 
    "0.13%", "", "", "0.00%", "", "", "0.01%", "", "", "0.04%", 
    "", "", "0.13%", "", "0.05%", "", "", "0.01%", "", "", "0.01%", 
    "", "", "0.32%", "", ""), FA_stdev = c("0.00%", "0.00%", 
    "0.01%", "", "", "0.01%", "", "", "0.02%", "", "", "0.19%", 
    "", "", "0.01%", "", "", "0.01%", "", "", "0.01%", "", "", 
    "0.27%", "", "0.02%", "", "", "0.01%", "", "", "0.00%", "", 
    "", "0.03%", "", ""), AA_stdev = c("0.00%", "0.00%", "0.03%", 
    "", "", "0.07%", "", "", "0.07%", "", "", "1.53%", "", "", 
    "0.02%", "", "", "0.04%", "", "", "0.03%", "", "", "0.78%", 
    "", "0.01%", "", "", "0.00%", "", "", "0.00%", "", "", "0.41%", 
    "", ""), PA_stdev = c("0.00%", "0.00%", "0.16%", "", "", 
    "0.08%", "", "", "0.41%", "", "", "0.37%", "", "", "0.14%", 
    "", "", "0.23%", "", "", "0.20%", "", "", "0.37%", "", "0.19%", 
    "", "", "0.01%", "", "", "0.03%", "", "", "0.19%", "", ""
    ), IBA_stdev = c("0.00%", "0.00%", "0.00%", "", "", "0.00%", 
    "", "", "0.00%", "", "", "0.09%", "", "", "0.00%", "", "", 
    "0.00%", "", "", "0.00%", "", "", "0.02%", "", "0.00%", "", 
    "", "0.01%", "", "", "0.00%", "", "", "0.00%", "", ""), BA_stdev = c("0.00%", 
    "0.00%", "0.00%", "", "", "0.00%", "", "", "0.02%", "", "", 
    "1.25%", "", "", "0.00%", "", "", "0.01%", "", "", "0.01%", 
    "", "", "0.34%", "", "0.00%", "", "", "0.00%", "", "", "0.00%", 
    "", "", "0.05%", "", ""), IVA_stdev = c("0.00%", "0.00%", 
    "0.01%", "", "", "0.01%", "", "", "0.00%", "", "", "0.17%", 
    "", "", "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", 
    "0.23%", "", "0.00%", "", "", "0.01%", "", "", "0.00%", "", 
    "", "1.28%", "", ""), VA_stdev = c("0.00%", "0.00%", "0.00%", 
    "", "", "0.00%", "", "", "0.00%", "", "", "0.30%", "", "", 
    "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", "0.00%", 
    "", "0.00%", "", "", "0.00%", "", "", "0.00%", "", "", "0.00%", 
    "", ""), OA_total_stdev = c("0.00%", "0.00%", "0.75%", "", 
    "", "0.63%", "", "", "1.63%", "", "", "3.54%", "", "", "0.60%", 
    "", "", "0.91%", "", "", "0.98%", "", "", "0.99%", "", "1.06%", 
    "", "", "0.07%", "", "", "0.12%", "", "", "5.46%", "", ""
    )), class = "data.frame", row.names = c(NA, -37L))

code:

# 1) RSTUDIO PACKAGE INSTALLATION ################################################

library(janitor)
library(tidyverse)
library(ggplot2)
library(readr)
library(dplyr)
library(rlang)
library(plotrix)
library(RColorBrewer)
library(ggpubr)

## A) Creating average data.frame ################################################

organic_acids_total_avg<-organic_acids %>% 
  select(Sample_overview,SA_avg,LA_avg,FA_avg,AA_avg,PA_avg,IBA_avg,BA_avg,IVA_avg,
         VA_avg,OA_total_avg) #select avg columns

organic_acids_total_avg_na<-organic_acids_total_avg %>%
  na_if("") %>% 
  na.omit

organic_acids_total_avg_na<-organic_acids_total_avg_na %>% 
  rename('Sample'='Sample_overview','Succinic Acid'='SA_avg',
         'Lactic Acid'='LA_avg','Formic Acid'='FA_avg','Acetic Acid'='AA_avg',
         'Propionic Acid'='PA_avg','Isobutyric Acid'='IBA_avg',
         'Butyric Acid'='BA_avg','Isovaleric Acid'='IVA_avg',
         'Valeric Acid'='VA_avg','Total Organic Acid'='OA_total_avg') # rename columns

## B) Creating stdev data.frame ################################################

organic_acids_total_stdev<-organic_acids %>% 
  select(Sample_overview,SA_stdev,LA_stdev,FA_stdev,AA_stdev,PA_stdev,IBA_stdev,
         BA_stdev,IVA_stdev,VA_stdev,OA_total_stdev) # select Stdev columns

organic_acids_total_stdev_na<-organic_acids_total_stdev %>% 
  na_if("") %>% 
  na.omit # remove rows with NA or zeroes

organic_acids_total_stdev_na<-organic_acids_total_stdev_na %>% 
  rename('Sample'='Sample_overview','Succinic Acid'='SA_stdev',
         'Lactic Acid'='LA_stdev','Formic Acid'='FA_stdev','Acetic Acid'='AA_stdev',
         'Propionic Acid'='PA_stdev','Isobutyric Acid'='IBA_stdev',
         'Butyric Acid'='BA_stdev','Isovaleric Acid'='IVA_stdev',
         'Valeric Acid'='VA_stdev','Total Organic Acid'='OA_total_stdev') # Rename columns

## C) Changing data.frame dimensions to longer data frame #######################

organic_acids_total_avg2<-organic_acids_total_avg_na %>% 
  pivot_longer(cols="Succinic Acid":"Total Organic Acid",
               names_to="Acid",
               values_to="Percent")

organic_acids_total_stdev2<-organic_acids_total_stdev_na %>% 
  pivot_longer(cols="Succinic Acid":"Total Organic Acid",
               names_to="Acid",
               values_to="stdev")

## D) Merging data.frames ########################################################

organic_acids_total_merged<-merge(organic_acids_total_avg2,organic_acids_total_stdev2,by=c("Sample","Acid"))

organic_acids_total_merged_numeric<-transform(organic_acids_total_merged,Percent=as.numeric(sub("%","",Percent)))

organic_acids_total_merged_numeric<-transform(organic_acids_total_merged_numeric,stdev=as.numeric(sub("%","",stdev)))

# summary(organic_acids_total_merged_numeric)
# view(organic_acids_total_merged_numeric)

# class(organic_acids_total_merged_numeric$Percent)
# class(organic_acids_total_merged_numeric$stdev)

## E) Plotting data ###############################################################


a<-ggplot(organic_acids_total_merged_numeric,aes(x=factor(Sample,level=c("Initial biomass","Initial biomass with CA",
                                                                "Aer_4hr","Aer_8hr","Aer_24hr",
                                                                "Aer_28day","Ana_4hr","Ana_8hr",
                                                                "Ana_24hr","Ana_28day","CA_4hr",
                                                                "CA_8hr","CA_24hr","CA_28day")),y=Percent,fill=factor(Acid,level=c("Acetic Acid",
                                                                                                                                   'Butyric Acid',
                                                                                                                                   'Formic Acid',
                                                                                                                                   'Isobutyric Acid',
                                                                                                                                   'Isovaleric Acid',
                                                                                                                                   'Lactic Acid',
                                                                                                                          'Propionic Acid',
                                                                                                                                   'Succinic Acid',
                                                                                                                                   'Valeric Acid',
                                                                                                                                   'Total Organic Acid'))))+
  geom_col(position=position_dodge())+
  labs(title="Organic Acid Profile",y="% of Dry Matter by Mass",x='Treatment Group',fill='Organic Acid')+
  scale_x_discrete(guide=guide_axis(angle=90))+
  geom_errorbar(aes(ymin=Percent-stdev,
                    ymax=Percent+stdev),
                position=position_dodge())+
  scale_fill_brewer(palette="Set3")+
  theme_classic()+
  theme(plot.title=element_text(size=20,hjust=0.5),
        axis.text.x=element_text(size=20),axis.title=element_text(size=20),
        axis.text.y=element_text(size=15),legend.text=element_text(size=12))


ggsave("total_OA_profile.png",h=8,w=12)


b<-ggplot(organic_acids_no_t_merged_numeric,aes(x=factor(Sample,level=c("Initial biomass","Initial biomass with CA",
                                                                      "Aer_4hr","Aer_8hr","Aer_24hr",
                                                                      "Aer_28day","Ana_4hr","Ana_8hr",
                                                                      "Ana_24hr","Ana_28day","CA_4hr",
                                                                      "CA_8hr","CA_24hr","CA_28day")),y=Percent,fill=factor(Acid,level=c("Acetic Acid",
                                                                                                                                         'Butyric Acid',
                                                                                                                                         'Formic Acid',
                                                                                                                                         'Isobutyric Acid',
                                                                                                                                         'Isovaleric Acid',
                                                                                                                                         'Lactic Acid',
                                                                                                                                         'Propionic Acid',
                                                                                                                                         'Succinic Acid',
                                                                                                                                         'Valeric Acid',
                                                                                                                                         'Total Organic Acid'))))+
  geom_col(position=position_dodge())+
  labs(title="Organic Acid Profile",y="% of Dry Matter by Mass",x='Treatment Group',fill='Organic Acid')+
  scale_x_discrete(guide=guide_axis(angle=90))+
  geom_errorbar(aes(ymin=Percent-stdev,
                    ymax=Percent+stdev),
                position=position_dodge())+
  scale_fill_brewer(palette="Set3")+
  theme_classic()+
  theme(plot.title=element_text(size=20,hjust=0.5),
        axis.text.x=element_text(size=20),axis.title=element_text(size=20),
        axis.text.y=element_text(size=15),legend.text=element_text(size=12))

ggsave("organic_acid_no_total.png",h=8,w=12)


c<-ggplot(organic_acids_no_sa_merged_numeric,aes(x=factor(Sample,level=c("Initial biomass","Initial biomass with CA",
                                                                     "Aer_4hr","Aer_8hr","Aer_24hr",
                                                                     "Aer_28day","Ana_4hr","Ana_8hr",
                                                                     "Ana_24hr","Ana_28day","CA_4hr",
                                                                     "CA_8hr","CA_24hr","CA_28day")),y=Percent,fill=factor(Acid,level=c("Acetic Acid",
                                                                                                                                        'Butyric Acid',
                                                                                                                                        'Formic Acid',
                                                                                                                                        'Isobutyric Acid',
                                                                                                                                        'Isovaleric Acid',
                                                                                                                                        'Lactic Acid',
                                                                                                                                        'Propionic Acid',
                                                                                                                                        'Valeric Acid'))))+
  geom_col(position=position_dodge())+
  labs(title="Organic Acid Profile",y="% of Dry Matter by Mass",x='Treatment Group',fill='Organic Acid')+
  scale_x_discrete(guide=guide_axis(angle=90))+
  geom_errorbar(aes(ymin=Percent-stdev,
                    ymax=Percent+stdev),
                position=position_dodge())+
  scale_fill_brewer(palette="Set3")+
  theme_classic()+
  theme(plot.title=element_text(size=20,hjust=0.5),
        axis.text.x=element_text(size=20),axis.title=element_text(size=20),
        axis.text.y=element_text(size=15),legend.text=element_text(size=12))

ggsave("organic_acid_no_sa.png",h=8,w=15)


d<-ggplot(organic_acids_sa_only_merged_numeric,aes(x=factor(Sample,level=c("Initial biomass","Initial biomass with CA",
                                                                     "Aer_4hr","Aer_8hr","Aer_24hr",
                                                                     "Aer_28day","Ana_4hr","Ana_8hr",
                                                                     "Ana_24hr","Ana_28day","CA_4hr",
                                                                     "CA_8hr","CA_24hr","CA_28day")),y=Percent,fill=factor(Acid,level=c('Succinic Acid'))))+
  geom_col(position=position_dodge())+
  labs(title="Succinic Acid",y="% of Dry Matter by Mass",x='Treatment Group',fill='Organic Acid')+
  scale_x_discrete(guide=guide_axis(angle=90))+
  geom_errorbar(aes(ymin=Percent-stdev,
                    ymax=Percent+stdev),
                position=position_dodge())+
  scale_fill_brewer(palette="Set3")+
  theme_classic()+
  theme(plot.title=element_text(size=20,hjust=0.5),legend.position="none",
        axis.text.x=element_text(size=20),axis.title=element_text(size=20),
        axis.text.y=element_text(size=15))

ggsave("sa_only.png",h=8,w=5)


e<-ggplot(organic_acids_total_only_merged_numeric,aes(x=factor(Sample,level=c("Initial biomass","Initial biomass with CA",
                                                                      "Aer_4hr","Aer_8hr","Aer_24hr",
                                                                      "Aer_28day","Ana_4hr","Ana_8hr",
                                                                      "Ana_24hr","Ana_28day","CA_4hr",
                                                                      "CA_8hr","CA_24hr","CA_28day")),y=Percent,fill=factor(Acid,level=c('Total Organic Acid'))))+
  geom_col(position=position_dodge())+
  labs(title="Total Organic Acids",y="% of Dry Matter by Mass",x='Treatment Group',fill='Organic Acid')+
  scale_x_discrete(guide=guide_axis(angle=90))+
  geom_errorbar(aes(ymin=Percent-stdev,
                    ymax=Percent+stdev),
                position=position_dodge())+
  scale_fill_brewer(palette="Set3")+
  theme_classic()+
  theme(plot.title=element_text(size=20,hjust=0.5),
        axis.text.x=element_text(size=20),axis.title=element_text(size=20),
        axis.text.y=element_text(size=15),legend.text=element_text(size=12),
        legend.position="none")


ggsave("total_OA_only.png",h=8,w=5)


# 9) COMBINE FIGURES ##########################################################

theme_set(theme_pubr)

?ggarrange()
figure<-ggarrange(a,b,c,d,e,labels=c('A','B','C','D','E'))


Now if I just try to do the plot by the name I assigned to it I get the following:

> a
Error in default[missing] : object of type 'closure' is not subsettable

And then I get the same error for the ggarrange() function.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.