daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #install.packages("ggplot2")
  2. library(ggplot2)
  3.  
  4. names <- c("Toshkent Xalqa Avtomobil Yo'li, Tashkent, Uzbekistan",
  5.            "Istiklol Palace",
  6.            "Dinamo",
  7.            "Tashkent Higher All-Troops Command College",
  8.            "SARC Uzbekiston Temir Yullari",
  9.            "Amir Temur Square",
  10.            "MY HOME")
  11.  
  12. addr <- c("Toshkent Xalqa Avtomobil Yo'li, Tashkent, Uzbekistan",
  13.           "Istiklol Palace, Tashkent, Uzbekistan",
  14.           "Dinamo, Tashkent, Uzbekistan",
  15.           "Tashkent Higher All-Troops Command College, Tashkent, Uzbekistan",
  16.           "SARC Uzbekiston Temir Yullari, Tashkent, Uzbekistan",
  17.           "Amir Temur Square, Tashkent, Uzbekistan",
  18.           "69.207378, 41.375954")
  19.  
  20. #coords <- geocode(enc2utf8(addr))
  21. #lon <- c(69.207378)
  22. #lat <- c(41.375954)
  23. #myhome <- as.data.frame(cbind(lon,lat))
  24. #coords
  25.  
  26. gc <- rbind(coords, myhome)
  27.  
  28. df <- data.frame(name = names, lon = gc$lon, lat = gc$lat)
  29.  
  30. cen <- c(mean(df$lon), mean(df$lat))
  31.  
  32. map <- get_googlemap(center = cen, maptype = "roadmap", zoom = 11, marker = gc)
  33.  
  34. gmap <- ggmap(map)
  35.  
  36. gmap + geom_text(data = df, aes(x = lon, y = lat),
  37.           size = 3, label = df$name)
RAW Paste Data
Top