Open Alonso-Garcia opened 4 years ago
Hello, I wanted to know if you were able to resolve that error, since I also had the same one.
Greetings.
Hello Omar, It's been a while, and I don't remember what I did anymore. You've probably already checked ChatGPT, but just in case you haven't, here's the answer it provide: "It seems like you're encountering an error in your R code while performing NMDS (Non-metric Multidimensional Scaling) ordination on microbiome data. The error message "missing value where TRUE/FALSE needed" suggests that there might be an issue with missing values in your data.
Here are a few steps you can take to troubleshoot and resolve the issue:
Check for Missing Values:
Ensure that there are no missing values in your data. You can use the any(is.na(data))
function to check for missing values in your 'ps2' object.
any(is.na(ps2$data))
If there are missing values, you may need to handle them appropriately, either by imputing missing data or removing samples/variables with missing values.
Inspect Your Data:
Take a closer look at your data, especially the transformed data using ps.prop2
, to make sure it appears as expected. Print the first few rows to inspect the structure.
head(otu_table(ps.prop2))
Check Sample Size: Ensure that the sample size (number of samples) is reasonable for NMDS. You might want to have a sufficiently large number of samples for a reliable ordination.
Consider Alternative Methods: If the issue persists, consider trying alternative methods or distance metrics for ordination. For example, you might try using Principal Coordinates Analysis (PCoA) instead of NMDS or exploring different distance metrics.
ord.pcoa.bray <- ordinate(ps.prop2, method="PCoA", distance="bray")
Update Packages: Make sure your R packages, especially those related to microbiome analysis, are up to date. You can update packages using:
update.packages(ask = FALSE, checkBuilt = TRUE)
After checking and addressing these points, you should be in a better position to identify and resolve the issue. If the problem persists, providing additional details about your data and the objects used in the analysis might help in offering more specific assistance."
Hello everybody, I'm analysing the bacteria community (16S region) for 189 samples. I followed the Workflow for Microbiome Data .
When I try to do the ordination (Transform data to proportions as appropriate for Bray-Curtis distances):
ps.prop2 <- transform_sample_counts(ps2, function(otu) otu/sum(otu))
ord.nmds.bray <- ordinate(ps.prop2, method="NMDS", distance="bray")
I have the following error:
Error in if (autotransform && xam > 50) { :
missing value where TRUE/FALSE needed
Could you help me to figure it out? Thank you :) Marta