Skip to content

Instantly share code, notes, and snippets.

@maelle
Created August 23, 2018 10:11
Show Gist options
  • Save maelle/1d4322c3de8b691d7d527dab9ac248c7 to your computer and use it in GitHub Desktop.
Save maelle/1d4322c3de8b691d7d527dab9ac248c7 to your computer and use it in GitHub Desktop.
Mi codigo abieRto
---
title: "¡Mejo`r icon::fa('r-project')` ciencia con rOpenSci!"
subtitle: "Maëlle Salmon <br/> [`r icon::fa('twitter')`](https://twitter.com/ropensci) ropensci [`r icon::fa('github')`](https://github.com/ropensci) ropensci [`r icon::fa('globe')`](https://ropensci.org) ropensci.org"
date: "2018/09/05"
output:
xaringan::moon_reader:
css: ["default", "metropolis", "metropolis-fonts", "my-theme.css"]
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
knitr::opts_chunk$set(echo = TRUE, cache = TRUE,
fig.align = 'center',
fig.width = 15, message = FALSE)
```
# Voy con retraso...
```{r}
spelling::spell_check_files("slides.Rmd",
lang = "es_AR")
```
---
# Bien però donde estan?
```{r}
library("opencage")
lugar <- opencage_forward("Universidad de Palermo Mario Bravo 1050, Buenos Aires",
countrycode = "AR",
limit = 1)$results
```
A ver... `lugar$annotations.flag` es `r lugar$annotations.flag`.
---
# Y si necesitan café?
OpenStreetMap al rescate!
---
# Zona de búsqueda
```{r bbox}
bbox <- bbox::lonlat2bbox(lugar$geometry.lng,
lugar$geometry.lat,
dist = 1, method = "lawn")
```
---
# Cafés con internet!
```{r cafes}
cafes <- osmdata::opq(bbox = bbox) %>%
osmdata::add_osm_feature(key = 'amenity', value = 'cafe') %>%
osmdata::add_osm_feature(key = 'internet_access') %>%
osmdata::osmdata_sf()
```
---
# Calles!
```{r calles}
calles <- osmdata::opq(bbox = bbox) %>%
osmdata::add_osm_feature(key = 'highway') %>%
osmdata::osmdata_sf()
```
---
# Mapa
```{r mapa}
library("ggplot2")
ggplot() +
geom_sf(data = calles$osm_lines) +
geom_sf(data = cafes$osm_points) +
theme_void()+
annotate("point",
lugar$geometry.lng,
lugar$geometry.lat,
col = "blue") +
coord_sf(datum = NA)
```
---
# Compartamos el codigo!
````{r gistr}
gist <- gistr::gist_create(files = "slides.Rmd",
description = "Mi codigo abieRto",
public = TRUE)
gist
```
---
# Codigo abieRto!
```{r webshot}
webshot::webshot(gist)
```
---
# ConectaR?
# Como podais participar?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment