Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@josecarlosgonz
josecarlosgonz / geojson.R
Last active May 17, 2021 10:28
How to create a geojson file in R from a dataframe
#Write geojson
#====
#Load libraries
library(rgdal)
#dataMap is a dataframe with coordinates on cols 11 (LATITUDE) and 12 (LONGITUDE)
#Transfor coordinates to numeric
dataMap$LATITUDE <- as.numeric(dataMap$LATITUDE)
dataMap$LONGITUDE <- as.numeric(dataMap$LONGITUDE)
@josecarlosgonz
josecarlosgonz / GoogleMapsAndR.md
Last active July 22, 2022 07:56
How to use Google's API with R

Using Google Maps API and R

This script uses RCurl and RJSONIO to download data from Google's API to get the latitude, longitude, location type, and formatted address

library(RCurl)
library(RJSONIO)
library(plyr)