# How do I extract my data as a ASV file for use in R?

**URL:** https://forum.qiime2.org/t/how-do-i-extract-my-data-as-a-asv-file-for-use-in-r/9096
**Category:** User Support
**Created:** [April 2, 2019, 5:06am UTC](https://forum.qiime2.org/t/how-do-i-extract-my-data-as-a-asv-file-for-use-in-r/9096 "2019-04-02T05:06:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Grace1](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/g/a9adbd/32.png) [@Grace1](https://forum.qiime2.org/u/Grace1)
#### Post date: [April 2, 2019, 5:06am UTC](https://forum.qiime2.org/t/how-do-i-extract-my-data-as-a-asv-file-for-use-in-r/9096/1 "2019-04-02T05:06:24Z")

</div>

Hi there,

I'm trying to use my QIIME outputs for data analysis in R using the phyloseq package.

Part of the code I'm using requires my files to be in .asv format. I thought I could get around this by converting my .biom file to a .tsv file, however I don't think this has helped.

I keep getting this error when trying to run the phyloseq fuction in R:  
code =  
physeq \<- phyloseq(asv.tab, tax.tab, sample.data)

error =  
Error in validObject(.Object) : invalid class “phyloseq” object:  
Component sample names do not match.  
Try sample\_names()

I was wondering

1. How do you extract your data from QIIME in ASV format, rather than biom or taxabarplot etc..

2. I have tried the sample\_names() function in a variety of ways and it has not worked. I've scoured the github-sphere and cannot figure out what the problem is, and the only think I can think is because the names in the files don't align somewhere and this is because I don't actually have an ASV file.

3. Has anyone had this error before? I can post my script up until the error point too if needs be.  
Also noting that I haven't had any errors with any of the other script in R up until this point.

Thanks 🙂

Grace

---

<div class="post-metadata">

### Author: ![Mehrbod\_Estaki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/mehrbod_estaki/32/4001_2.png) [@Mehrbod\_Estaki](https://forum.qiime2.org/u/Mehrbod_Estaki)
#### Post date: [April 2, 2019, 7:24am UTC](https://forum.qiime2.org/t/how-do-i-extract-my-data-as-a-asv-file-for-use-in-r/9096/2 "2019-04-02T07:24:20Z")

</div>

Hi @Grace1,  
There's an easy way to get your qiime2 data into R and into phyloseq objects in [this Community Contribution](https://forum.qiime2.org/t/tutorial-integrating-qiime2-and-r-for-data-visualization-and-analysis-using-qiime2r/4121) tutorial. Give that a go and let us know if you run into any problems.  
Good luck!

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [May 3, 2019, 1:26pm UTC](https://forum.qiime2.org/t/how-do-i-extract-my-data-as-a-asv-file-for-use-in-r/9096/3 "2019-05-03T13:26:45Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
