Skip to content

Instantly share code, notes, and snippets.

@kohske
Created March 31, 2012 03:01
Show Gist options
  • Save kohske/2258869 to your computer and use it in GitHub Desktop.
Save kohske/2258869 to your computer and use it in GitHub Desktop.
Nested Loop in R
# nested loop creation
s <- (Reduce(function(a, b) substitute(`for`(i, j:3, x), list(i = as.name(letters[b]), j = `if`(b == 1, 1, as.name(letters[b-1])), x = a)), 4:1, quote(print(c(a, b, c, d)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment