metacoder icon indicating copy to clipboard operation
metacoder copied to clipboard

Error for running alpha diversity analysis

Open biosciences opened this issue 3 years ago • 1 comments

I tried to run alpha diversity analysis from https://grunwaldlab.github.io/metacoder_documentation/workshop--07--diversity_stats.html, and test below codes: library(vegan) sample_data$alpha <- diversity(obj$data$otu_rarefied[, sample_data$SampleID], MARGIN = 2, index = "invsimpson") hist(sample_data$alpha)

It returned such error: Error: Corrupt grouped_df using old (< 0.8.0) format. ℹ Strip off old grouping with ungroup(). Run rlang::last_error() to see where the error occurred.

rlang::last_trace() <error/rlang_error> Corrupt grouped_df using old (< 0.8.0) format. ℹ Strip off old grouping with ungroup(). Backtrace: █

  1. ├─base::$<-(...)
  2. └─dplyr:::$<-.grouped_df(...)
  3. ├─name %in% group_vars(x)
  4. ├─dplyr::group_vars(x)
  5. └─dplyr:::group_vars.data.frame(x)
  6. ├─generics::setdiff(names(group_data(x)), ".rows")
    
  7. ├─dplyr::group_data(x)
    
  8. └─dplyr:::group_data.grouped_df(x)
    
  9.   └─dplyr::validate_grouped_df(.data)
    

biosciences avatar Jul 30 '21 12:07 biosciences

I do not get that error when I tried it just now. Try downloading "clean_data.Rdata" again and to make sure it is the updated version and try the code again.

zachary-foster avatar Aug 02 '21 21:08 zachary-foster

I also got this error right now

Unaimend avatar Aug 29 '23 07:08 Unaimend

I am still not getting this error:

load("~/Downloads/clean_data.Rdata")

library(vegan)
#> Loading required package: permute
#> Loading required package: lattice
#> This is vegan 2.6-4
sample_data$alpha <- diversity(obj$data$otu_rarefied[, sample_data$SampleID],
                               MARGIN = 2,
                               index = "invsimpson")
hist(sample_data$alpha)

Created on 2023-09-05 with reprex v2.0.2

Can someone send me the URL to the "clean_data.Rdata" file they are using (or attach it) and their sessionInfo? Thanks

zachary-foster avatar Sep 05 '23 23:09 zachary-foster

Hello,

I am also having exactly the same issue.

Have you found a solution for this?

Thanks,

KY

kayanac avatar Nov 30 '23 23:11 kayanac

I have not been able to reproduce the problem. Until I can do that, there is very little hope of fixing the issue. Can you send me the URL to the "clean_data.Rdata" file you are using (or attach it) and your sessionInfo? Thanks

zachary-foster avatar Nov 30 '23 23:11 zachary-foster

Thank you for your quick response! I downloaded from the link below.

https://grunwaldlab.github.io/analysis_of_microbiome_community_data_in_r/07--diversity_stats.html

kayanac avatar Nov 30 '23 23:11 kayanac

Ahh, ok, that was the original website for the workshop, but we have been keeping an updated version here:

https://grunwaldlab.github.io/metacoder_documentation/workshop--00--introduction.html

I thought that website had been taken down actually. I will replace it with a link to the current location

zachary-foster avatar Nov 30 '23 23:11 zachary-foster

Thanks! Glad that it's solved.

kayanac avatar Nov 30 '23 23:11 kayanac