I have a bunch of bateria and I want to know their taxanomic name, here I use Taxize package in R and got the "table" of taxanomy, due to the format problem here I'm not able to show it clearly, but for example it's like there are three titles for three columns naming "name", "rank" and "id", and below "rank", there are "phylum", "class", "order", "family", "genus". and "species", accordingly below "name" they are Firmicutes, Erysipelotrichia, Erysipelotrichales, Erysipelotrichaceae, Erysipelatoclostridium, [Clostridium] innocuum, here I need the name of phylum and genus for this bacteria, which are Firmicutes and Erysipelatoclostridium, how I can extract them(there are 184 bacteria i want to do the same way) this is not a data frame so I try to use data,frame(), but it says cannot coerce class ""classification"" to a data.frame, and I don't know how to extract the information that I want, anybody knows it? Many thanks!
could you post example data here and the code you have used?
SInce you are using taxize package, following is the easier way to get the information you want (in a dataframe):
you can change database such as itis instead of ncbi. code output:
output as data frame:
If you already have a classification object, use the following code (but change the row ids as per your object):
test (classification object)
In this classification class, for each bacterium, row 3 and 7 are phylum and genus respectively. So following code extracts phylum and genus for two bacteria and saves them as dataframe.
test object is obtained above.
output of test1: