map<-read.csv("Thailand_Border.csv",header=TRUE) head(map) map[,1]<-(map[,1]-min(map[,1])*(1/(max(map[,1])-min(map[,1])))) map[,2]<-(map[,2]-min(map[,2])*(1/(max(map[,2])-min(map[,2])))) We can plot it quickly to make sure there are no mistakes: plot(NULL,xlim=c(0,1),ylim=c(0,1),axes=F,xlab="",ylab="",main="") polygon(map) map[,1]<-map[,1]*8.34+97.33 map[,2]<-map[,2]*14.838+ 5.612 plot(NULL,xlim=c(94,108.83),ylim=c(5.5,20.5),axes=F,xlab="",ylab="", main="Thailand") polygon(map,col="palegreen1") placidus<-readLines("A_placidus.txt") # placidus head(placidus) words<-strsplit(placidus," ") # words words<-unlist(words) # head(words) degrees.All<-grep("°",words) words[degrees.All] dec.mins<-words[degrees.All+1] dec.mins placidus.coords<-cbind(words[degrees.All],dec.mins) placidus.coords placidus.coords[,2]<-gsub("'","",placidus.coords[,2]) placidus.coords[,1]<-gsub("°","",placidus.coords[,1]) placidus.coords[,2]<-as.numeric(placidus.coords[,2])*(100/60) placidus.coords[,2]<-gsub("\\.","",placidus.coords[,2]) new.degrees<-paste(placidus.coords[,1],".",placidus.coords[,2],sep="") lat<-(c(1:10)*2)-1 long<-(c(1:10)*2) points(as.numeric(new.degrees[long]),as.numeric(new.degrees[lat]),pch=10) mtext ("Aleiodes placidus",font=3)