#Convert matrix from data.frame to export into csv file
mean <- as.matrix(summary$table)

#Write.table gives csv output of Summary. Be sure to specify the directory and the output files will be stored there
write.table(mean, file = "Distance.csv", sep =",", row.names = TRUE, col.names = TRUE, qmethod ="double")