Dear Alexandre,
> for(typeD in 1:Dist){
> k <- fitdistr(BD,typeD[Dist])
Your code should probably read "for(typeD in 1:length(Dist))"
or "for(typeD in seq_along(Dist)".
Then, instead of "typeD[Dist]", make it "Dist[typeD]".
Please see if that helps.
Best,
microbiomics