library(rjson) library(leaflet) data<-read.csv("nepal_data.csv", header=TRUE) #Jitter points so we can see everything data$lat<-jitter(data$lat,amount=0.025) data$long<-jitter(data$long,amount=0.025) #TODO #Get project ids and build hyperlinks data$bridge_id<-ifelse(data$bridge_id==0,'None',as.character(data$bridge_id)) data$content <- paste(sep = "
", paste("Organization:",data$org), paste("BRIDGE ID:",data$bridge_id), paste("Total Disbursed to Date: ",paste("$",format(data$total_disbursed,big.mark=",")),sep=""), paste("First Disbursement Sent:",data$date_of_first_disbursement) ) pal <- colorFactor(c("#E37F1C","#C54626","#4C2432"), domain = data$date_of_first_disbursement) data$color<-pal(data$date_of_first_disbursement) data<-data[complete.cases(data),] output <- toJSON(unname(split(data, 1:nrow(data)))) output<-paste("markers=",output) write(output,"maps/markers.json")