"my1" <- function(x, minx=min(x)) { # Here is a smart function
x <- x # Needed for nested calls, e.g., bs(scale(x))
if(smart.mode.is("read")) {
smart <- get.smart()
minx <- smart$minx # Overwrite its value
} else
if(smart.mode.is("write"))
put.smart(list(minx=minx))
sqrt(x-minx)
}
attr(my1, "smart") <- TRUE
Run the code above in your browser using DataLab