First, to get an idea on what is Phylogeny, please download from the "data" folder, a testing dataset for 20 SARS-COV-2 genomes from GISAID.
library(Biostrings); library(ape)
fa <- 'D:/data/gisaid/20genome.fa.gz'
gen0 <- readDNAStringSet(fa, format='fasta')
gen <- subseq(gen0, start=21563, end=25384) # to extract spike protein region
gen <- chartr("-","N", replaceAmbiguities(gen0))
dist_dna <- ape::dist.dna(ape::as.DNAbin(gen))
plot(hclust(dist_dna))
tree_nj <- ape::nj(dist_dna)
plot.phylo(as.phylo(tree_nj), type="radial")