I continue to receive an error code: There were 50 or more warnings (use warnings() to see the first 50)

See the FAQ: How to do a minimal reproducible example reprex for beginners for a better way to pose questions. Fortunately the chickwts dataset is a built-in.

by(chickwts[, 1], chickwts[,"feed"], mean)
#> chickwts[, "feed"]: casein
#> [1] 323.5833
#> ------------------------------------------------------------ 
#> chickwts[, "feed"]: horsebean
#> [1] 160.2
#> ------------------------------------------------------------ 
#> chickwts[, "feed"]: linseed
#> [1] 218.75
#> ------------------------------------------------------------ 
#> chickwts[, "feed"]: meatmeal
#> [1] 276.9091
#> ------------------------------------------------------------ 
#> chickwts[, "feed"]: soybean
#> [1] 246.4286
#> ------------------------------------------------------------ 
#> chickwts[, "feed"]: sunflower
#> [1] 328.9167