Skip to content

Instantly share code, notes, and snippets.

View larnsce's full-sized avatar

Lars Schöbitz larnsce

View GitHub Profile
library(tidycensus)
library(ggiraph)
library(tidyverse)
library(patchwork)
vt_income <- get_acs(
geography = "county",
variables = "B19013_001",
state = "VT",
year = 2019,
@dmenne
dmenne / bookdowncrossreference.Rmd
Last active February 14, 2023 20:16
Markdown to HTML: Cross-references and captions for tables and figure
---
title: "Markdown to HTML: Cross-references and captions for tables and figure"
output:
bookdown::html_document2
---
Update December 2022: `gt` and `rtables` (partially) have cross-references.
And there is [`quarto`](https://quarto.org/docs/authoring/cross-references.html), not treated here, which has a much more elegant referencing syntax.
@jennybc
jennybc / 2020-03-29_sane-legend.R
Created March 30, 2020 05:21
Make the legend order = data order, with forcats::fct_reorder2()
library(tidyverse)
library(patchwork)
dat_wide <- tibble(
x = 1:3,
top = c(4.5, 4, 5.5),
middle = c(4, 4.75, 5),
bottom = c(3.5, 3.75, 4.5)
)
@mine-cetinkaya-rundel
mine-cetinkaya-rundel / shiny-intro.R
Last active July 31, 2020 10:47
Intro walkthrough in Shiny app
library(shiny)
library(rintrojs)
ui <- fluidPage(
introjsUI(), # Must include UI
titlePanel("Hello Shiny!"),
sidebarLayout(
sidebarPanel(
sliderInput(inputId = "bins",
## GOAL:
## re-create a figure similar to Fig. 2 in Wilson et al. (2018),
## Nature 554: 183-188. Available from:
## https://www.nature.com/articles/nature25479#s1
##
## combines a boxplot (or violin) with the raw data, by splitting each
## category location in two (box on left, raw data on right)
# initial set-up ----------------------------------------------------------
@Pakillo
Pakillo / ggplot_resources.md
Last active October 17, 2022 04:38
ggplot2: tutorials and complementary packages
@robinkraft
robinkraft / osgeo_compile.sh
Created June 24, 2014 01:41
compile and install GEOS, PROJ4 and GDAL from source on Ubuntu 12.0.4
# Compile/install GEOS. Taken from:
# http://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu#GEOS_2
cd /tmp
wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
bunzip2 geos-3.4.2.tar.bz2
tar xvf geos-3.4.2.tar
cd geos-3.4.2
@jeromyanglim
jeromyanglim / example-r-markdown.rmd
Created May 17, 2012 04:23
Example of using R Markdown
This post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown)
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96.
This combination of tools provides an exciting improvement in usability for
[reproducible analysis](http://stats.stackexchange.com/a/15006/183).
Specifically, this post
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96;
(2) provides a basic example of producing console output and plots using R Markdown;
(3) highlights several code chunk options such as caching and controlling how input and output is displayed;
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and
(5) discusses the implications of R Markdown.
@simonmichael
simonmichael / gist:1070020
Created July 7, 2011 17:15
sample invoice layout in pandoc markdown
# INVOICE 20110706xx
------------------------------------- ---------------------------------
**To:**<br> **From:**<br>
Client XX<br> me<br>
address<br> address<br>
<br> <br>
<br> Email: ...<br>
<br> Phone: ...<br>