Skip to content

Instantly share code, notes, and snippets.

View bniebuhr's full-sized avatar

Bernardo Brandão Niebuhr bniebuhr

View GitHub Profile
@manuelep
manuelep / .gitignore
Last active October 26, 2022 06:37
dev grass docker container
notebook-home
# File 1: Rmd template
---
title: "Untitled"
author: "Bernardo, Yves"
date: "3/24/2022"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
@grimbough
grimbough / example.Rmd
Created June 3, 2019 14:48
Reusing code chunks from an existing Rmarkdown document
This code chunk will extract all code blocks from `example.Rmd` and write them to a temporary file, preservining chunk options. It will then read them and make those chunks avaliable in the current R environment when the presentation is knitted.
```{r include, eval=TRUE, echo=FALSE, include = FALSE}
tmp_script <- tempfile()
knitr::purl("example.Rmd", output=tmp_script, quiet = TRUE)
knitr::read_chunk(tmp_script)
```
We can then include a chunk from `example.Rmd` like so:
@rafapereirabr
rafapereirabr / stacked_map_R_ggplot2.md
Last active March 29, 2023 18:41
Creating a stacked map in R using ggplot2

This gist shows in two steps how to tilt and stack maps using ggplot2 in order to create an image like this one: [![enter image description here][1]][1]

Let's load the necessary libraries and data to use a reproducible example:

# load libraries
  library(rgeos)
  library(UScensus2000tract)
  library(ggplot2)