Skip to content

Instantly share code, notes, and snippets.

View sebastiansauer's full-sized avatar
🇺🇦
🇺🇦

Sebastian Sauer sebastiansauer

🇺🇦
🇺🇦
View GitHub Profile
@daattali
daattali / linkedin.R
Created March 5, 2016 11:11
Scraping Twitter and LinkedIn info in R
# Get a person's name, location, summary, # of connections, and skills & endorsements from LinkedIn
# URL of the LinkedIn page
user_url <- "https://www.linkedin.com/in/daattali"
# since the information isn't available without being logged in, the web
# scraper needs to log in. Provide your LinkedIn user/pw here (this isn't stored
# anywhere as you can see, it's just used to log in during the scrape session)
username <- "yourusername"
password <- "yourpassword"
@krassowski
krassowski / example_font_awesome.R
Created March 17, 2022 18:06
ggplot geom_font_awesome
library(ggplot2)
source('geom_font_awesome.R')
shapes_map = c(
setosa = 'car',
virginica = 'ban',
versicolor = 'star'
)
(
@acoppock
acoppock / gelman_and_hill_chapter_3.R
Created September 16, 2018 14:33
Gelman and Hill Chapter 3 Using ggplot and estimatr
# Gelman and Hill 2007: Chapter 3 Regression Examples
# Using ggplot and estimatr
rm(list = ls())
# Uncomment to install
# install.packages("ggplot2")
# install.packges("haven")
# install.pacakges("estimatr")
library(ggplot2)
@briandk
briandk / rmarkdown.yml
Created March 21, 2016 01:31
Default YAML block for RMarkdown Manuscripts
title: "[Title Goes Here]"
author: "[Blinded for Review]"
documentclass: "article"
output:
pdf_document:
keep_tex: true
number_sections: true
highlight: "tango"
toc: true
md_extensions: +implicit_figures +grid_tables +fenced_code_blocks +fenced_code_attributes
@briandk
briandk / generate_package_citations.R
Created April 9, 2017 18:21
Wil Doane's system for automatically generating bibliography entries for the R packages you're using
# Early in the script
pkgs_pre_script <- try(devtools::loaded_packages(), silent = TRUE)
# Late in the script
pkgs_used_during_script <- try(devtools::loaded_packages(), silent = TRUE)
cat("* ")
print(citation(), style="text") # or Bibtex or LaTeX
@mmparker
mmparker / applytorows.r
Created April 18, 2014 00:03
Ways to use a non-vectorized function on every row of a data.frame
# Sample data
X <- data.frame(
x = c(1, 2, 3),
y = c(4, 5, 6),
etc = c("a", "b", "c")
)
# Arbitrary stand-in for function that can't be vectorized (no pmax)
max.fun <- function(a, b) { max(c(a, b)) }