library(rbiom)
    
    hmp10        <- hmp50$clone()
    hmp10$counts <- hmp10$counts[,1:10]
    
    dm <- bdiv_distmat(hmp10, 'unifrac')
    
    distmat_stats(dm, groups = pull(hmp10, 'Body Site'))
    
    distmat_stats(dm, groups = pull(hmp10, 'Age'))
    
    # See the R code used to calculate these statistics:
    stats <- distmat_stats(dm, groups = pull(hmp10, 'Age'))
    stats$code
Run the code above in your browser using DataLab