GetWalkScores.r

source('R/getWS.R')

key = ""

directory_path <- '~/Desktop'
file_name <- '/Data_50m.csv';
locations <- read.csv(paste0(directory_path,file_name))

walkscore = vector(mode = "numeric", length = dim(locations)[1]);
for (i in 1:dim(locations)[1])
{
  temp <- getWS(locations[i,8],locations[i,3],locations[i,4],key);
  # print(locations[i,8])
  # print(locations[i,3])
  # print(locations[i,4])
  if(is.na(temp$walkscore))
  {
    walkscore[i] <- -100;
  }else
  {
    walkscore[i] <- temp$walkscore; 
  }
}
locations <- cbind(locations,walkscore);
write.csv(file=paste0(directory_path,"/walkscore.csv"),locations)
ajinkyaghorpade/walkscores documentation built on Oct. 1, 2018, 12:21 a.m.