Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Examples of how to get ggplot and lm style function calls.
someFunction = function(y, data = NULL)
{
arguments <- as.list(match.call())
y = eval(arguments$y, data)
sum(y)
}
myData = data.frame(A = c(1,2,3), B = c(10,9,8))
someFunction(A, data=myData)
someFunction(B, data=myData)
someFunction(A)
X = c(1,2,3,4,5,6)
someFunction(X)
someFunction(X, data=myData)
A = c(1,2)
someFunction(A)
someFunction(A, data=myData)
someFunction("A", data=myData)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.