library(ggplot2)
library(dplyr)
library(ggmap)
library(sp)
library(maptools)
library(rgeos)
library(googleVis);op <- options(gvis.plot.tag='chart')
data <- read.csv(choose.files(), header = T, sep = ";")
head(data, 3)
##   id    slat    slon    hlat    hlon
## 1  1 54°43'N 20°30'E 54°43'N 20°30'E
## 2  2 55°49'N  49°7'E 55°49'N  49°7'E
## 3  3 61°41'N 42°32'E 61°41'N 42°32'E
for(i in 2:5) {
  data[,i] <- as.character(data[,i])
}
str(data)
## 'data.frame':    73 obs. of  5 variables:
##  $ id  : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ slat: chr  "54°43'N" "55°49'N" "61°41'N" "59°34'N" ...
##  $ slon: chr  "20°30'E" "49°7'E" "42°32'E" "30°08'E" ...
##  $ hlat: chr  "54°43'N" "55°49'N" "61°41'N" "59°34'N" ...
##  $ hlon: chr  "20°30'E" "49°7'E" "42°32'E" "30°08'E" ...
data$slat1 = char2dms(data$slat, chd = "°", chm = "'") %>% as("numeric")
data$slon1 = char2dms(data$slon, chd = "°", chm = "'") %>% as("numeric")
data1 <- data[,c(1,6,7)]
data1$latlong<-paste(data$slat1, data1$slon1, sep=":")
head(data1,3)
##   id    slat1    slon1                           latlong
## 1  1 54.71667 20.50000             54.7166666666667:20.5
## 2  2 55.81667 49.11667 55.8166666666667:49.1166666666667
## 3  3 61.68333 42.53333 61.6833333333333:42.5333333333333
data("wrld_simpl")
map = fortify(wrld_simpl)
## Regions defined for each Polygons
ggplot(map) +
  geom_polygon(data = map, aes(long, lat, group = group), color = "black", fill = "white") + 
  geom_point(data = data1, aes(x = slon1, y = slat1), color = "red")+
  coord_map()

map <- gvisMap(data1, locationvar="latlong", 
               tipvar="id")
      options = list(showTip=T, showLine=F, enableScrollWheel=TRUE,
              useMapTypeControl=T, width=1400,height=800)
plot(map)
rm(list=ls()) #clear workspace