s-news
[Top] [All Lists]

Using Objects within a user-defined function

To: "S-News List" <s-news@lists.biostat.wustl.edu>
Subject: Using Objects within a user-defined function
From: "Thomas D. Fletcher" <tom.fletcher@cox.net>
Date: Thu, 6 Jan 2005 11:43:42 -0500
Importance: Normal
S-News List,

I have been trying to create a function that will simplify a graphing
function for me that intend to do frequently. The trouble is that when I use
a function within the user-defined function, objects are not available. Is
there a way around this?

Here is a relatively simple example of what I am trying to do:

uni.g<-function(v1,dat)
{
a<-bwplot(~v1,data=dat)
print(a,split=c(1,1,2,2))
}

When I try to call the function by specifying something like:

uni.g(VARNAME,DATAFRAME)

I get an error saying that object v1 not identified. Is this because of the
Trellis function or more general to the use of objects within functions?

Can anyone help with a solution?

Thanks
Tom


*** ++++++++++++ ***
Thomas D. Fletcher
Department of Psychology
Old Dominion University
Office (757) 683 - 3725
tflet002@odu.edu
*** ++++++++++++ ***



<Prev in Thread] Current Thread [Next in Thread>
  • Using Objects within a user-defined function, Thomas D. Fletcher <=