I have a file called species.txt which I edited to only contain a list of species from blast output. Literally just one column with species names which include genus and species separated by a space.
My goal is to just loop through that file (each line is a species), and obtain its taxonomy rankings using
tax_name(species, get=c("superkingdom","kingdom","phylum","order","family","genus","species"), db="ncbi")
Afterwards I would grab whichever taxonomy ranking I desire for each species and create some tables with that information.
Is there a simple way to do this in R without using a for loop? I think lapply would work but I am unable to figure out how to read in the file without having to write a for loop (which I am terrible at); and some files will have thousands of species in the list so a for loop would not be efficient in my opinion.
I have read in my file using readLines, but still unsure how to actually turn this into function with lapply. Is it possible to avoid a for loop here at all?