Skip to content

Instantly share code, notes, and snippets.

View degaray's full-sized avatar

degaray

  • Sofía Salud
  • Mexico City
View GitHub Profile
@degaray
degaray / find_unbound.r
Last active September 4, 2015 02:04
Obtain all the undefined variables in an expression
find_unbound <- function(lang) {
stopifnot(is.language(lang), !is.expression(lang))
bound <- character()
unbound <- character()
rec_fun <- function(lang) {
if(is.call(lang)) {
# These are assignment calls; if any symbols are assigned and have
# not already been found in a leaf, they are defined as bound