[R] Referring to an object name from within a function

zerfetzen paul.heinrich.dietrich at gmail.com
Wed Dec 29 15:18:04 CET 2010

Can anyone show me how to refer to an object name that is passed to a
function, from within the function?

For example:

MyModel <- 1

test <- function(x) {
     if(x == 1) {cat("x is a valid object.\n")}


What I would like this to do is pass MyModel to function test, and if it
passes a test, be able to print "MyModel is a valid object."

View this message in context: http://r.789695.n4.nabble.com/Referring-to-an-object-name-from-within-a-function-tp3167147p3167147.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list