Skip to content

Instantly share code, notes, and snippets.

@topepo
topepo / vary.R
Created August 4, 2019 21:06
Alternative infrastructure for finding and coordinating varying parameters in recipes and models
# A prototype mechanism to collect the tunable parameters and their sources. It
# also allows for parameter with the same to be tuned. For example, you might
# model some variables with a spline but want to allow for different degrees
# of freedom by adding a different `step_ns()` for each variable. This interface
# allows the user to add an annotation for the parameter so that we can tell the
# different parameters apart.
# Limitations:
# - Currently, only one varying value is allowed per argument. For example, if
# some argument had a length two vector as its format, you can do something
@gaborcsardi
gaborcsardi / notes.Rmd
Last active July 16, 2019 00:15
TGM 2019-07-15
---
title: "Some new features in processx and callr"
output: html_notebook
---
# Better errors in processx, callr, gh
## Better errors from C
```{r error = TRUE}
@wch
wch / symbol_table.R
Last active July 30, 2019 19:34
Get contents of R symbol table
# get_symbols() returns all symbols that are registered in R's symbol table.
#
# new_symbols() returns all symbols that have been added since the last time
# new_symbols() was run. If you want to test whether your code causes the symbol
# table to grow, run new_symbols(), then run your code, then run new_symbols()
# again.
get_symbols <- inline::cfunction(
includes = "
#define HSIZE 49157 /* The size of the hash table for symbols */
@DavisVaughan
DavisVaughan / lm-hell.r
Created May 31, 2019 19:38
Exploring the object size of `lm()` objects with enclosing environments
library(purrr)
library(lobstr)
library(glue)
library(rlang, warn.conflicts = FALSE)
make_an_lm <- function() {
x <- rep(1L, times = 10000000)
cat(glue("x is {object.size(x)}B"))
lm(1 ~ 1)
}
@domenic
domenic / redirecting-github-pages.md
Created February 10, 2017 19:28
Redirecting GitHub pages after a repository move

Redirecting GitHub Pages after a repository move

The problem

You have a repository, call it alice/repo. You would like to transfer it to the user bob, so it will become bob/repo.

However, you make heavy use of the GitHub Pages feature, so that people are often accessing https://alice.github.io/repo/. GitHub will helpfully redirect all of your repository stuff hosted on github.com after the move, but will not redirect the GitHub Pages hosted on github.io.

The solution

@tbadams45
tbadams45 / app.R
Created August 4, 2016 21:14
Using conditionalPanel inside of Shiny Modules
testUI <- function(id, label = "CSV file") {
# Create a namespace function using the provided id
ns <- NS(id)
tagList(
selectizeInput(
ns('mySelect'), 'Test Select', choices = state.name,
options = list(
placeholder = 'Please select an option below',
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream