Suparna Mitra
2016-Jun-11 17:46 UTC
[R] Writing multiple adonis output from multiple list file in R
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]]