# Maaslin2() reference error

**URL:** <https://forum.biobakery.org/t/maaslin2-reference-error/7286>\
**Category:** MaAsLin\
**Created:** [July 17, 2024, 4:34am UTC](https://forum.biobakery.org/t/maaslin2-reference-error/7286 "2024-07-17T04:34:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sooni](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/sooni/32/2661_2.png) [@sooni](https://forum.biobakery.org/u/sooni)\
**Post date:** [July 17, 2024, 4:34am UTC](https://forum.biobakery.org/t/maaslin2-reference-error/7286/1 "2024-07-17T04:34:25Z")

</div>

An error occurred during analysis using Maaslin2(). The following is the code I ran and the error that occurred.

```auto
fit_data2 <- Maaslin2(input_data = maaslin2_taxo,
                      input_metadata = maaslin2_metadata,
                      min_prevalence = 0, normalization = "NONE",
                      output = "MaAsLin2 Output (Taxo_IBD)",
                      fixed_effects = c("Case_status", "IBD"),
                      reference = c("Case_status, Patient", "IBD, Y"))
[1] "Warning: Deleting existing log file: MaAsLin2 Output (Taxo_IBD)/maaslin2.log"
2024-07-17 13:20:46.875378 INFO::Writing function arguments to log file
2024-07-17 13:20:46.893984 INFO::Verifying options selected are valid
2024-07-17 13:20:46.896145 INFO::Determining format of input files
2024-07-17 13:20:46.898438 INFO::Input format is data samples as rows and metadata samples as rows
2024-07-17 13:20:46.930703 INFO::Formula for fixed effects: expr ~ Case_status + IBD
The following error occurred in relevel.factor(metadata[, i], ref = ref):
 'ref' must be an existing level

```

Referring to the error message, I checked the level of the variable entered in the reference option.

```auto
> levels(maaslin2_metadata$Case_status)
[1] "Control" "Patient"     
> levels(maaslin2_metadata$IBD)
[1] "N" "Y" ""

```

Why does an error occur? I don’t think my code is wrong. If there is something wrong or you know how to fix it, please let me know.

Thank you for help!

---

<div class="post-metadata">

**Author:** ![sooni](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/sooni/32/2661_2.png) [@sooni](https://forum.biobakery.org/u/sooni)\
**Post date:** [July 18, 2024, 12:35am UTC](https://forum.biobakery.org/t/maaslin2-reference-error/7286/2 "2024-07-18T00:35:57Z")

</div>

I solved it! The problem was the spacing in the reference option!
