Calculate distance for otutab

mat_dist(otutab, method = "bray", spe_nwk = NULL)

Arguments

otutab

an otutab data.frame, samples are columns, taxs are rows.

method

Dissimilarity index, partial match to "bray", "euclidean"...see vegdist;unifrac

spe_nwk

a phylo tree if use unifrac...

Value

dist

Examples

data(otutab, package = "pcutils")
mat_dist(otutab)
#>           NS1       NS2       NS3       NS4       NS5       NS6       WS1
#> NS2 0.2965660                                                            
#> NS3 0.3323402 0.3751370                                                  
#> NS4 0.2855628 0.3480858 0.3022878                                        
#> NS5 0.3165963 0.4463875 0.2980537 0.2942927                              
#> NS6 0.2434597 0.3109617 0.2983203 0.2508816 0.2999133                    
#> WS1 0.3201161 0.3352240 0.4265117 0.3887775 0.4425429 0.3551867          
#> WS2 0.3646047 0.3473055 0.3734335 0.3905948 0.4071137 0.3837565 0.3122491
#> WS3 0.3480162 0.3577600 0.3441503 0.3609970 0.3837411 0.3402655 0.3294407
#> WS4 0.2967074 0.3373663 0.3512114 0.3304827 0.3649465 0.3044028 0.2921066
#> WS5 0.2889362 0.2876754 0.3513299 0.3071177 0.3597646 0.2752830 0.2648791
#> WS6 0.2955487 0.3381644 0.4107853 0.3825360 0.4389549 0.3279140 0.2221531
#> CS1 0.3094583 0.2888336 0.3739254 0.3212190 0.3662677 0.3316728 0.3597004
#> CS2 0.3173883 0.3271860 0.3712177 0.3248951 0.3339775 0.3365611 0.3862186
#> CS3 0.3038897 0.2773702 0.3549280 0.3183995 0.3802031 0.3062071 0.2621714
#> CS4 0.3172429 0.2694326 0.3466595 0.3290539 0.3862462 0.3053884 0.3128831
#> CS5 0.3230703 0.3181010 0.3558341 0.3098866 0.3288596 0.3165792 0.3850319
#> CS6 0.2975436 0.2947895 0.3169318 0.3125958 0.3357337 0.3150505 0.2885701
#>           WS2       WS3       WS4       WS5       WS6       CS1       CS2
#> NS2                                                                      
#> NS3                                                                      
#> NS4                                                                      
#> NS5                                                                      
#> NS6                                                                      
#> WS1                                                                      
#> WS2                                                                      
#> WS3 0.3041845                                                            
#> WS4 0.2957956 0.2477695                                                  
#> WS5 0.2641258 0.2825082 0.2485861                                        
#> WS6 0.3100069 0.3235327 0.2742592 0.2607908                              
#> CS1 0.3145018 0.2841887 0.2685819 0.2667580 0.3645669                    
#> CS2 0.3770223 0.3213232 0.2953696 0.3201886 0.4110985 0.2238269          
#> CS3 0.2727989 0.2873709 0.2530456 0.2091304 0.2894032 0.2426291 0.2839732
#> CS4 0.3219782 0.2922064 0.2638720 0.2563024 0.3145427 0.2673050 0.2565048
#> CS5 0.3413452 0.3133234 0.3046742 0.2664775 0.3759246 0.2498088 0.2763230
#> CS6 0.2407601 0.2626449 0.2534544 0.2187759 0.3055443 0.2385660 0.2776826
#>           CS3       CS4       CS5
#> NS2                              
#> NS3                              
#> NS4                              
#> NS5                              
#> NS6                              
#> WS1                              
#> WS2                              
#> WS3                              
#> WS4                              
#> WS5                              
#> WS6                              
#> CS1                              
#> CS2                              
#> CS3                              
#> CS4 0.2219958                    
#> CS5 0.2873145 0.2999030          
#> CS6 0.2081052 0.2519347 0.2547914