Hi,
I need to create one chao1 value for each row. However, when I use the following functions---chaodist(), vegdist(), chao1(), or aggregate()---they all end up creating errors. I have added my codes and some repeatable data. Could one of you awesome people please help me create a chao1 value? Dput and codes are below. Thanks in advance!!!
CODES
require(vegan)
require(tidyverse)
require(ggplot2)
require(OTUtable)
upload data
species.dat <- structure(list(...
#Put raw data into long format
species.dat_long <- as.data.frame (species.dat) %>% tibble::rownames_to_column(var = "Plot") # Turn rownames into a column
#Add site column (ANOVA needs at least three names per site)
long_data_new <- species.dat_long %>% mutate(Site = case_when(str_detect(Plot, "D") ~ "Decatur", str_detect(Plot, "H") ~ "Field Station", str_detect(Plot, "C") ~ "Cedartown", TRUE ~ "Unknown"))
#first try
vegdist(species.dat_long$, method="chao")
#second try
agg <- aggregate(Decatur, data=long_data_new , chao)
#third try
chaodist(species.dat$Decatur)
DPUT
structure(list(s__Clostridium_XlVa_unclassified = c(0.001848, 0, 0.00488, 0.004071, 0, 0.002439, 0.012116, 0.011045, 0, 0.004917, 0.002289, 0.001408), s__Gracilibacteraceae_unclassified = c(0.001848, 0, 0, 0.001357, 0.012309, 0.012197, 0.012116, 0.007363, 0, 0, 0.002289, 0), s__Jahnella_unclassified = c(0.00739, 0.004204, 0.00244, 0.001357, 0.004103, 0.004879, 0.006058, 0.005523, 0, 0.004917, 0.004578, 0), s__Luteimonas_unclassified = c(0.003695, 0.002102, 0, 0.004071, 0, 0, 0.006058, 0.007363, 0.013913, 0, 0.006866, 0), s__Propionivibrio_unclassified = c(0.001848, 0, 0, 0.005428, 0, 0.007318, 0.012116, 0.018408, 0, 0, 0, 0), s__Rhodoferax_koreense = c(0.005543, 0.01051, 0.014641, 0.010856, 0, 0, 0, 0, 0, 0, 0, 0), s__Rhodopseudomonas_unclassified = c(0.012933, 0.004204, 0.00488, 0.009499, 0.002051, 0.002439, 0, 0.001841, 0.001988, 0, 0, 0)), class = "data.frame", row.names = c("D15B", "D610B", "D15F", "D610F", "HR15B", "HR610B", "HR15F", "HR610F", "C15B", "C610B", "C15F", "C610F"))