ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
203 stars 58 forks source link

How to handle missing values (NA) in RDA? #85

Open amrvx4 opened 2 years ago

amrvx4 commented 2 years ago

Dear Chi Liu, first of all thank you very much for such a comprehensive package. I have been using this package extensively for my metagenomic analysis

When I tried to run RDA analysis, I get this error

` KIN_bac_exp_1$cal_rda(use_dbrda = TRUE, use_measure = "bray")
Error in na.fail.default(list(BG = c(8.01, 7.43, 14.56, 6.98, 5.61, 8.94,  : 
  missing values in object`

I do have NA values in some of my environmental variables (env data) I believe the RDA is based on vegan and I tried to omit NAs

`KIN_bac_exp_1$cal_rda(use_dbrda = TRUE, use_measure = "bray",na.action = na.omit)
Error in KIN_bac_exp_1$cal_rda(use_dbrda = TRUE, use_measure = "bray",  : 
  unused argument (na.action = na.omit)`

Any way to work around this ?

Thank you!

ChiLiubio commented 2 years ago

Hi, @amrvx4 Please first see the complete_na parameter in trans_env$new. If complete_na = TRUE, the function can run interpolation to fill the NA with the method in mice package. Sure another way is to filter those samples with na values. Please select the suitable way and feel free to tell me if the result is not good.

Chi