Help me with a bioinformatics script

I'm trying to write a script where I can have RStudio take DNA sequences that I gave it, plug them into BLASTn, and return the top matches into a data frame that can be exported as a .csv file. Where do I start?

Do you have ncbi-blast+ installed? Are you set up to use packages?