[R] Writing multiple adonis output from multiple list file in R
Suparna Mitra
suparna.mitra.sm at gmail.com
Sat Jun 11 19:46:22 CEST 2016
Hello R experts,
I am trying to do adonis (vegan package) on multiple files using loop.
But I am having hard time in this.
Here is what I tried.
setwd("PATH")
files <- list.files(pattern = "[.]txt$")
ldf <- lapply(files, read.table, row.names=1)
str(ldf)
res <- lapply(ldf, summary)
for (i in length(res))
{Addon[[i]]<-adonis(vegdist(t(ldf[[i]]))~Factor)
}
print(i)
But obviously this is not working.
Until the list it works fine. Also if I test with
print(adonis(vegdist(t(ldf[[1]]))~Factor)), this also provised correct
result.
But specifying the Addon[[i]], is something wrong. Please help,
Thanks a lot,
Mitra
[[alternative HTML version deleted]]
More information about the R-help
mailing list