importing qza file to Rstidio

Hi All,
I did some basic 16s analysis in qiime2 and wanted to import the rooted-tree.qza file from qiime2 to Rstudio. This should be an easy and quick step, but I have been getting error:

Error in pilot_rooted - tree = read_qza("/Users/ar/Desktop/qiime2_2/pilot_rooted-tree.qza") : 
  object 'pilot_rooted' not found

It looks very straightforward, but it is jus not working. I have doubled checked the input file path is all right. I am using Rstudio 1.1.463, and the qza file was generated by qiime2- 2019.1 version. Could anyone please let me know what is gong wrong? Thanks a lot!

Welcome :slight_smile:

Usually the error you are seeing means, that you are trying to access a variable/object, which is not defined, e.g.

> a
Error: object 'a' not found
> a = 2
> a
[1] 2

Look at your code and see if that is applicable to your situation?

Hi @Leon,
Thank you for the reply. The file I am accessing is the qza file, which is a rooted phylogenetic tree generated by qiime2. Honestly I don't know if it is defined or not. May I know what the "define" mean in this context?

Another I am confused is that the file I am accessing is "pilot_rooted-tree.qza", which is the full name for the file. But the error message said object "pilot_rooted" is not found. I don't know if the Rstudio was really searching for "pilot_rooted" or "pilot_rooted-tree.qza". If searched for a file with "pilot_rooted", it does not exist in my folder and not surprising that R can not find.

Thank you again!

Wait a minute - Perhaps you wrote:

pilot_rooted - tree = read_qza("/Users/ar/Desktop/qiime2_2/pilot_rooted-tree.qza")

But actually meant:

pilot_rooted_tree = read_qza("/Users/ar/Desktop/qiime2_2/pilot_rooted-tree.qza")

?

Hi @Leon,
I was also concerned with that and tried both "pilot_rooted-tree" and "pilot_rooted_tree". Unfortunately, neither worked. this is a bit tricky...

I think the second line, i.e.

pilot_rooted_tree = read_qza("/Users/ar/Desktop/qiime2_2/pilot_rooted-tree.qza")

should work, but there is a qiime2R tutorial here, perhaps you can find some pointers there.

Hi @Leon,

It worked :rofl::rofl::rofl:
Don't know why, but when I re-ran pilot_rooted_tree, it worked. While, pilot_rooted-tree still did not work.

Thanks so much for sharing the link, that is exactly what I am following to do the analysis.

Have a great day.

So since I teach... Here is a task for you - take a look at pilot_rooted-tree vs pilot_rooted_tree and see if you can figure out why the first does not work (and really really should not)

Hi @Leon,
The difference between the two names is "_" and "-". Probably "-" in R has some other function in R can not be used as a symbol connecting words? That's the furthest thing I could guess as a R beginner :joy:

Please correct me if this is nonsense, Thank you!

Ok, based on your answer - If you really want Iearn R, I highly suggest, that you head on over to R for Data Science and start at page 1 :+1:

Thank you. That is the best ever suggestion I got about R. Gotta spend some time on reading.

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