"Error in get(as.character(FUN), mode = "function", envir = envir) : object '.' of mode 'function' was not found"

Without a reprex (see the FAQ) that includes this dataset or a proxy for it that is conveniently sized and reproduces the error, only generalities can be offered.

You will find analysis much easier if you abbreviate variable names to be short enough to remind you of what they represent, without spaces so that quoting isn't needed. For presenting results, the variable names can be replaced with textual descriptions like these. The {gt} package makes this especially easy.

is.numeric() returns typeof logical, so a vector of TRUE, FALSE values. It doesn't necessarily do anything to change SO2$Unit and I'm unclear what the intent is.

I approach everything in R with school algebra in mind f(x) = y where

x is what is at hand, in this case a data frame of some number of columns, that contain multiple observations of a variable of interest

y is what is desired, ultimately, is a plot showing the relative mean value of observations by unit of observation

f is the function(s) that will transform x into y. f, x and y are objects (because everything in R is an object) and any of them may be, and often is, composite. Once I have expressed the problem this way, the solution falls out naturally, as in this reprex.

library(dplyr)
#> 
#> 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(ggplot2)
d <- data.frame(`Name of the state` = c(
  "PA", "MO", "MS", "UT",
  "IA", "ND", "DE", "NY", "WI", "IA", "DE", "AL", "WY", "NM", "CT",
  "WV", "NJ", "SD", "CO", "CT", "CO", "AZ", "RI", "IN", "MA", "MD",
  "SC", "MS", "NC", "NV", "NH", "NJ", "UT", "MT", "NE", "OK", "NH",
  "GA", "GA", "OR", "NV", "IN", "KS", "RI", "KS", "OR", "PA", "WY",
  "WA", "WI", "IA", "OR", "KY", "TN", "KS", "TN", "MI", "ND", "WV",
  "MS", "WI", "VT", "AL", "AL", "IA", "KS", "GA", "UT", "ID", "IA",
  "CT", "WV", "SD", "IN", "OH", "AR", "TN", "NY", "HI", "MD", "IN",
  "CT", "VA", "WA", "WY", "GA", "NM", "NY", "FL", "MA", "OK", "IN",
  "GA", "NH", "ID", "WI", "SC", "MS", "AK", "AK", "MD", "HI", "PA",
  "WV", "IN", "MT", "SC", "NM", "ND", "WA", "WI", "AL", "AL", "CO",
  "OR", "KY", "DE", "MT", "DE", "WY", "CT", "OR", "NJ", "CO", "AK",
  "FL", "KY", "ND", "TN", "SD", "AZ", "TN", "VA", "AL", "SD", "OH",
  "NV", "KS", "FL", "NC", "MI", "TX", "NY", "WA", "MA", "VT", "NH",
  "CT", "CA", "AR", "NV", "MT", "WA", "NC", "NC", "PA", "WI", "OR",
  "AR", "GA", "IL", "ME", "WY", "TX", "PA", "LA", "TN", "SD", "NE",
  "WY", "WI", "MD", "FL", "TX", "NH", "PA", "CO", "AK", "FL", "NJ",
  "CT", "SD", "WV", "TX", "MT", "IN", "LA", "SC", "WI", "PA", "WY",
  "ND", "NC", "IA", "AK", "NE", "RI", "KY", "NY", "AR"
), `Sulfur dioxide concentrations in lb` = c(
  "0.0997411983467738",
  "0.396344767736071", "0.333484041248253", "0.0240304102960913",
  "0.221483073681077", "0.636891605003212", "0.303299715344369",
  "0.891804572912339", "0.473140448471018", "1.25731917511138",
  "0.0311651411698044", "0.898636929642391", "0.359625222198162",
  "1.35877526208334", "0.205995311504275", "0.0666298153856201",
  "0.34621442017199", "0.101529222667248", "0.752760224809996",
  "2.19111452103114", "0.354610217511222", "0.0470780068442286",
  "0.0608716699186879", "0.279653853256678", "0.766561497584105",
  "0.918726216365805", "1.28866193985768", "0.345616556109717",
  "1.91824989868075", "2.02467339306636", "1.05986384579608", "1.46545467856862",
  "0.458852661150319", "0.518112532783663", "0.703851012355732",
  "1.89753699142293", "0.487354268600023", "0.9797390973393", "0.58900915834946",
  "0.373967600326285", "0.114411373886674", "0.535488129542859",
  "1.06673372213867", "0.244780184542944", "0.638299688873222",
  "0.346909352626907", "0.583480103593877", "0.625008138701835",
  "0.30845327731324", "1.49883513375361", "0.667469789796671",
  "1.09876359286151", "0.49603145302084", "0.63140596293502", "1.28181920106875",
  "0.446444143267931", "0.478441037140408", "0.178023438038268",
  "0.633327762178293", "1.24799864958795", "0.134264863446557",
  "0.384127010700245", "0.590695837102452", "0.937954033605213",
  "0.771717746666158", "0.227437787243036", "0.907231307941791",
  "1.795517359902", "0.826725659562113", "2.08647004900678", "0.818021252685568",
  "1.06845665818182", "1.51365713326037", "1.07138007289553", "0.713930687989301",
  "1.55341626459086", "0.45031117575214", "0.268020081864797",
  "0.512550066219443", "0.223320482952044", "0.101319248106474",
  "0.506629230111058", "2.46075100551593", "0.949072914806093",
  "0.527621645421617", "0.278861219907126", "0.565913752160586",
  "0.860797656069459", "1.73831977202758", "1.23169059615475",
  "0.457322606518421", "1.07163226747932", "1.12608542225467",
  "2.03759085234291", "1.12205005011075", "0.0280868008530836",
  "0.374073749066723", "0.810376159374571", "0.312100819689855",
  "0.272938761394433", "0.0467723382367606", "2.18208965846731",
  "0.301495840524547", "0.811230932070892", "0.105047302098884",
  "1.08979701526752", "0.091991996931922", "1.08819737402022",
  "1.22996903075262", "1.02173707842887", "0.949066126767172",
  "0.219042064694913", "1.37233729556397", "2.33431020519293",
  "0.0926762170052267", "0.157556053640337", "0.105062887704363",
  "0.1313002500671", "1.49353065545033", "1.07228043414154", "0.589455493812533",
  "0.764426101501826", "0.999013380921451", "0.304651788546765",
  "1.39618178790483", "0.798612350531306", "1.54123127367133",
  "1.92823029592934", "1.3070145056838", "1.06633372038674", "1.58135268650556",
  "0.651110920701269", "0.768141292425366", "0.82028882675966",
  "0.630482390893486", "0.907728104070671", "1.46183781195517",
  "0.812024238277529", "1.08312387963359", "0.968449919316272",
  "2.3559333077917", "0.0124593860877256", "0.0454252623052119",
  "1.94982121472185", "1.64713164689432", "0.383525097171707",
  "1.05574297374064", "0.831262401179872", "0.761692222208132",
  "0.0178211259036171", "0.0661867710595452", "1.05998706528118",
  "1.355846370015", "1.61358022602622", "0.711787945495513", "0.209632449156998",
  "0.349001232590709", "0.242556861790133", "0.668765919271833",
  "0.429615409613837", "0.600550035798642", "0.0857245854466102",
  "0.398046874977001", "0.849156552063022", "0.396256693996826",
  "0.69150167635097", "2.2222717674791", "1.43812334510439", "0.25188264615885",
  "1.62833753671939", "0.0773713962906696", "0.0580143677071979",
  "1.10227375906238", "0.312912644289102", "1.573034714098", "0.370079291479429",
  "1.09684874301205", "1.46104746297348", "1.37087436755721", "1.09006384153599",
  "1.29136080135936", "0.0744287983548976", "0.775028360916466",
  "0.325967667493582", "1.35072911738016", "0.246989435945465",
  "1.26294657219993", "0.99705497959444", "1.41018950272064", "0.421017729340597",
  "0.661583957332138", "0.170948443280891", "0.128574175862476",
  "2.17508859486582", "0.27578114753599", "0.771815142037307",
  "1.90460823058916", "1.10610761975323", "0.335285704893781",
  "0.714097717350692"
))

# select all rows by index column number
#               ,    c(1,2)
# it's easier to find index numbers than it is
# to do all the typing of names
d <- d[,c(1,2)]
# replace the column names; dplyr::rename
# only needed if you are renaming based on
# some pattern matching and transformation
# over more than this handful of variables
colnames(d) <- c("st","so2")

# convert so2 to numeric
d$so2 <- as.numeric(d$so2)

# calculate state grouped means
# and omit AK, HI
omit <- c("AK","HI")
d_av <- d |>
  group_by(st) |>
  summarise(Mean = mean(so2)) |>
  filter(!st %in% omit)

# do the presentation embellishments in the
# display object, not the data object
ggplot(d_av,aes(st,Mean)) +
  geom_col() +
  labs(title = "2022 Sulfur Dioxide Pollution in Continental United States",
       subtitle = "Source: U.S. Environmental Protection Agency",
       caption = "Prepared by Yoyodyne Corp.") +
       xlab("State") +
       ylab("Unit unadjusted SO4 Emissions (tons)") +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  theme_minimal()

Created on 2023-06-28 with reprex v2.0.2