Skip to content

Instantly share code, notes, and snippets.

rexp.to.sexp <- function(exp){
exp <- substitute(exp)
if(is.call(exp)) {
s <- "("
i <- 0
while (i < length(exp)) {
i <- i + 1
separator <- if( i == 1 ) "" else " "
s <- paste(s,
eval(substitute(rexp.to.sexp(e), list(e = exp[[i]]))),