Skip to content

Instantly share code, notes, and snippets.

@renato04
Created June 6, 2019 00:10
Show Gist options
  • Save renato04/e4d42ff1a7f95c8873e6371b17faa982 to your computer and use it in GitHub Desktop.
Save renato04/e4d42ff1a7f95c8873e6371b17faa982 to your computer and use it in GitHub Desktop.
Northest, Southest baltimore cameras
install.packages("openxlsx")
library(openxlsx)
fileX = "https://github.com/elthonf/fiap-mba-r/raw/master/data/cameras.baltimore.xlsx"
directory = 'data'
file.name = basename(fileX)
download = function(f, d){
if(!file.exists(d)){
dir.create(d)
}
file.local = file.path(d, basename(f))
if(!file.exists(file.local)){
download.file(url = f, destfile = file.local , mode='wb')
}
}
download(fileX, directory)
sheet = read.xlsx(file.path(directory, file.name))
northCam = which.max(sheet$Lat)
sotuhCam = which.min(sheet$Lat)
eastCam = which.max(sheet$Long)
oestCam = which.min(sheet$Long)
sheet[northCam,]
sheet[sotuhCam,]
sheet[eastCam,]
sheet[oestCam,]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment