Skip to content

Instantly share code, notes, and snippets.

View cderv's full-sized avatar

Christophe Dervieux cderv

View GitHub Profile
@kellobri
kellobri / app.R
Last active April 10, 2023 09:20
How-To: Leverage R Markdown output files to create simple ETL processes on RStudio Connect (These are two separate data assets)
library(shiny)
library(DT)
data <- read.csv('https://colorado.rstudio.com/rsc/content/2352/data.csv')
ui <- fluidPage(
titlePanel("Basic Data Filter Application"),
hr(),
h4("This application presents data generated by a scheduled R Markdown process: ", tags$a(href="https://colorado.rstudio.com/rsc/content/2352", "See it here!")),
p("Use this framework to build out your own R Markdown-based ETL jobs hosted on RStudio Connect."),
@djnavarro
djnavarro / ggplot2_geomvector.R
Created March 30, 2019 03:30
Custom ggplot2 geom that plots a (subset of a) vector field
library(ggplot2)
library(dplyr)
library(tibble)
library(tidyr)
GeomVector <- ggproto("GeomVector", Geom,
required_aes = c("x", "y", "direction", "length"),
default_aes = aes(
@malcolmbarrett
malcolmbarrett / move_slides_to_web.R
Last active April 2, 2019 10:28
Move R Markdown HTML slides to Blogdown and Push to Web
# install.packages(c("here", "fs", "stringr", "purrr", "git2r"))
# to add invisibly in your R profile, open with usethis::edit_r_profile()
# then define it in an environment, e.g.
# .env <- new.env()
# .env$move_slides_to_web <- {function definition}
move_slides_to_web <- function(folder = NULL, index = NULL) {
if (is.null(folder)) {
@djnavarro
djnavarro / thank_you_stars.R
Created January 30, 2019 11:17
animated thank you message made from stars
# devtools::install_github("yixuan/fontr")
library(fontr)
library(transformr)
library(showtext)
library(tidyverse)
library(gganimate)
# use showtext to loading Google fonts (http://www.google.com/fonts)
font_add_google("Allura")
@krlmlr
krlmlr / Rprofile-entrace
Last active January 7, 2021 01:59
Pretty stack traces in R
# Add this to your .Rprofile
options(
error = quote(rlang::entrace()),
rlang__backtrace_on_error = "collapse" # or "branch" or "full"
)
@zappingseb
zappingseb / RTest_medium.xml
Last active January 8, 2019 00:06
RTest: A package for human readable tests in R
<?xml version="1.0" encoding="UTF-8"?>
<RTestCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/RTest.xsd">
<ID>RTest_TC-medium</ID>
<synopsis>
<version>01</version>
<author>Sebastian Wolf</author>
<creation-date>2018-12-11</creation-date>
</synopsis>
<input-data>
library(tidyverse)
library(magick)
steps <- 10000L
coil_turns <- 3L
max_r <- coil_turns * 2 * pi
imgs <- image_graph(300, 300, res = 30)
rotation <- pi/4
@RLesur
RLesur / crrry.R
Last active November 18, 2018 16:27
A proposal for a Chrome Remote Interface with R
# A proposal for a Chrome Remote Interface with R
# Copyright: Romain Lesur
# Year: 2018
# License: MIT
# Browser and websocket connection helpers --------------------------------
# From milesmcbain/chradle (MIT License)
debugger_200_ok <- function(port, retry_delay = 0.2, max_attempts = 15, attempt = 1) {
if (max_attempts <= attempt) {
stop(paste0("Reached max attempts (", max_attempts,
@RLesur
RLesur / pdf.R
Last active November 14, 2018 10:22
PDF generation from R using the Chrome DevTools Protocol
# Packages ---------------------------------------------------------------
remotes::install_github('milesmcbain/chradle')
remotes::install_github('rlesur/pagedown@automation')
library(chradle)
library(pagedown)
library(httpuv)
# Chrome headless helpers -------------------------------------------------
# Thanks to Miles McBain
browser_init <- function(debug_port = 9222, bin = "google-chrome"){
@HanjoStudy
HanjoStudy / useR2018.md
Last active November 10, 2023 02:07
useR2018 Material

I am looking forward to meeting you at the Tuesday AM (10th of July) tutorial session at useR2018!. We will be discussing a subject that I am very passionate about: Web Scraping!

The slides can be found here:

To ensure that we can be immediately productive on Tuesday morning, I would like you to get the following set up on your machines beforehand: