Created
October 15, 2014 10:06
-
-
Save Jianghao/0270552fd123c2470ffb to your computer and use it in GitHub Desktop.
Visual full POIs in China
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------- | |
# main | |
# -------------------------- | |
### initial | |
library(plyr) | |
library(dplyr) | |
library(data.table) | |
setwd("~/path-to-folder/") | |
### Fast merge Rdata with FastMergeDF | |
dir <- dir(path = "data/Rdata_merge/", pattern = glob2rx("*.Rdata"), | |
recursive = T, full.names = TRUE) | |
fddf.blank <- data.frame("poiid"=NA, "title"=NA, "address"=NA, "lon"=NA, "lat"=NA, | |
"category"=NA, "city"=NA, "categorys"=NA, "category_name"=NA, | |
"checkin_user_num"=NA, "checkin_num"=NA, "photo_num"=NA) | |
fddf <- FastMergeDF(path = dir, df.blank = fddf.blank[-1, ], filter = TRUE) | |
double <- c("lon", "lat") | |
integer <- c("city", "checkin_user_num", "checkin_num", "photo_num") | |
fddf[, double] <- lapply(fddf[, double], as.double) | |
fddf[, integer] <- lapply(fddf[, integer], as.integer) | |
save(fddf, file = "data/Rdata_merge_one.Rdata") | |
# -------------------------- | |
# Layout figures | |
# -------------------------- | |
# png(filename = "sina-poi-xyplot-2.png", width=3000, height = 2000) | |
# with(fddf, plot(lon, lat, cex=0.3, pch = 16, col=rgb(0,0,0,0.25))) | |
# dev.off() | |
png(filename = "sina-poi-xyplot-cex0.3-black-alpha0.25-011.png", width=3000, height = 2000) | |
par(bg="black") | |
with(fddf, plot(lon, lat, cex=0.3, pch = 16, col=rgb(0,1,1,0.25))) | |
dev.off() | |
### End of script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment